Module Uri.ParamsSource

URI fragment or query parameters.

Params.t values represent key-value parameters stored in strings as "k0=v0&k1=v1...". They can be constructed from any Jstr.t. In particular it means they can be used with an URI fragment or query.

Parameters

Sourcetype t

The type for URLSearchParams objects.

Sourceval is_empty : t -> bool

is_empty ps is true if ps has no key value bindings.

Sourceval mem : Jstr.t -> t -> bool

mem k ps is true if key k is bound in ps.

Sourceval find : Jstr.t -> t -> Jstr.t option

find k ps is the value of the first binding of k in ps.

Sourceval find_all : Jstr.t -> t -> Jstr.t list

find_all k ps are the values of all bindings of k in ps.

Sourceval fold : (Jstr.t -> Jstr.t -> 'a -> 'a) -> t -> 'a -> 'a

fold f ps acc folds all the key value bindings.

Converting

Sourceval of_obj : Jv.t -> t

of_obj o uses the keys of object o to define URL parameters.

Sourceval of_jstr : Jstr.t -> t

of_jstr s URL decodes and parses parameters from s.

Sourceval to_jstr : t -> Jstr.t

to_jstr ps URL encodes the parameters ps to a string.

Sourceval of_assoc : (Jstr.t * Jstr.t) list -> t

of_assoc assoc are parameters for the assoc assoc.

Sourceval to_assoc : t -> (Jstr.t * Jstr.t) list

to_assoc ps is ps as an assoc list.