Module Map.String
specalized when key type is string, more efficient than the generic type, its compare behavior is fixed using the built-in comparison
type key = stringtype 'value tThe type of maps from type key to type 'value.
val empty : 'v tval isEmpty : 'v t -> boolval has : 'v t -> key -> boolval cmpU : 'v t -> 'v t -> ('v -> 'v -> int) Js.Fn.arity2 -> intval cmp : 'v t -> 'v t -> ('v -> 'v -> int) -> intval eqU : 'v t -> 'v t -> ('v -> 'v -> bool) Js.Fn.arity2 -> boolval eq : 'v t -> 'v t -> ('v -> 'v -> bool) -> booleq m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data.
val findFirstByU :
'v t ->
(key -> 'v -> bool) Js.Fn.arity2 ->
(key * 'v) optionval findFirstBy : 'v t -> (key -> 'v -> bool) -> (key * 'v) optionfindFirstBy m p uses funcion f to find the first key value pair to match predicate p.
let s0 = fromArray ~id:(module IntCmp) [|4,"4";1,"1";2,"2,"3""|];;
findFirstBy s0 (fun k v -> k = 4 ) = option (4, "4");;val forEachU : 'v t -> (key -> 'v -> unit) Js.Fn.arity2 -> unitval forEach : 'v t -> (key -> 'v -> unit) -> unitforEach m f applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.
val reduceU : 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2) Js.Fn.arity3 -> 'v2val reduce : 'v t -> 'v2 -> ('v2 -> key -> 'v -> 'v2) -> 'v2reduce m a f computes (f kN dN ... (f k1 d1 a)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.
val everyU : 'v t -> (key -> 'v -> bool) Js.Fn.arity2 -> boolval every : 'v t -> (key -> 'v -> bool) -> boolevery m p checks if all the bindings of the map satisfy the predicate p. Order unspecified
val someU : 'v t -> (key -> 'v -> bool) Js.Fn.arity2 -> boolval some : 'v t -> (key -> 'v -> bool) -> boolsome m p checks if at least one binding of the map satisfy the predicate p. Order unspecified
val size : 'v t -> intval toList : 'v t -> (key * 'v) listIn increasing order.
val toArray : 'v t -> (key * 'v) arrayval fromArray : (key * 'v) array -> 'v tval keysToArray : 'v t -> key arrayval valuesToArray : 'v t -> 'v arrayval minKey : _ t -> key optionval minKeyUndefined : _ t -> key Js.undefinedval maxKey : _ t -> key optionval maxKeyUndefined : _ t -> key Js.undefinedval minimum : 'v t -> (key * 'v) optionval minUndefined : 'v t -> (key * 'v) Js.undefinedval maximum : 'v t -> (key * 'v) optionval maxUndefined : 'v t -> (key * 'v) Js.undefinedval get : 'v t -> key -> 'v optionval getUndefined : 'v t -> key -> 'v Js.undefinedval getWithDefault : 'v t -> key -> 'v -> 'vval getExn : 'v t -> key -> 'vval checkInvariantInternal : _ t -> unitraise when invariant is not held
val remove : 'v t -> key -> 'v tremove m x returns a map containing the same bindings as m, except for x which is unbound in the returned map.
val removeMany : 'v t -> key array -> 'v tval set : 'v t -> key -> 'v -> 'v tset m x y returns a map containing the same bindings as m, plus a binding of x to y. If x was already bound in m, its previous binding disappears.
val updateU : 'v t -> key -> ('v option -> 'v option) Js.Fn.arity1 -> 'v tval update : 'v t -> key -> ('v option -> 'v option) -> 'v tval mergeU :
'v t ->
'v2 t ->
(key -> 'v option -> 'v2 option -> 'c option) Js.Fn.arity3 ->
'c tval merge :
'v t ->
'v2 t ->
(key -> 'v option -> 'v2 option -> 'c option) ->
'c tmerge m1 m2 f computes a map whose keys is a subset of keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f.
val mergeMany : 'v t -> (key * 'v) array -> 'v tval keepU : 'v t -> (key -> 'v -> bool) Js.Fn.arity2 -> 'v tval keep : 'v t -> (key -> 'v -> bool) -> 'v tkeep m p returns the map with all the bindings in m that satisfy predicate p.
val partitionU : 'v t -> (key -> 'v -> bool) Js.Fn.arity2 -> 'v t * 'v tval partition : 'v t -> (key -> 'v -> bool) -> 'v t * 'v tpartition m p returns a pair of maps (m1, m2), where m1 contains all the bindings of s that satisfy the predicate p, and m2 is the map with all the bindings of s that do not satisfy p.
val split : key -> 'v t -> 'v t * 'v option * 'v tsplit x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.
val mapU : 'v t -> ('v -> 'v2) Js.Fn.arity1 -> 'v2 tval map : 'v t -> ('v -> 'v2) -> 'v2 tmap m f returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.
val mapWithKeyU : 'v t -> (key -> 'v -> 'v2) Js.Fn.arity2 -> 'v2 tval mapWithKey : 'v t -> (key -> 'v -> 'v2) -> 'v2 t