Module Uri.Params

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

type t

The type for URLSearchParams objects.

val is_empty : t -> bool

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

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

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

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

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

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

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

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

fold f ps acc folds all the key value bindings.

Converting

val of_obj : Jv.t -> t

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

val of_jstr : Jstr.t -> t

of_jstr s URL decodes and parses parameters from s.

val to_jstr : t -> Jstr.t

to_jstr ps URL encodes the parameters ps to a string.

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

of_assoc assoc are parameters for the assoc assoc.

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

to_assoc ps is ps as an assoc list.