Belt_MutableMapString
val make : unit -> 'a t
val clear : 'a t -> unit
val isEmpty : 'a t -> bool
val cmpU : 'a t -> 'a t -> ('a -> 'a -> int) Js.Fn.arity2 -> int
cmp m1 m2 cmp
First compare by size, if size is the same, compare by key, value pair
val eqU : 'a t -> 'a t -> ('a -> 'a -> bool) Js.Fn.arity2 -> bool
val forEachU : 'a t -> (key -> 'a -> unit) Js.Fn.arity2 -> unit
forEach 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 application order of f
is in increasing order.
val reduceU : 'a t -> 'b -> ('b -> key -> 'a -> 'b) Js.Fn.arity3 -> 'b
reduce 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 : 'a t -> (key -> 'a -> bool) Js.Fn.arity2 -> bool
every m p
checks if all the bindings of the map satisfy the predicate p
. The application order of p
is unspecified.
val someU : 'a t -> (key -> 'a -> bool) Js.Fn.arity2 -> bool
some m p
checks if at least one binding of the map satisfy the predicate p
. The application order of p
is unspecified.
val size : 'a t -> int
val valuesToArray : 'a t -> 'a array
val minKeyUndefined : _ t -> key Js.undefined
val maxKeyUndefined : _ t -> key Js.undefined
val minUndefined : 'a t -> (key * 'a) Js.undefined
val maxUndefined : 'a t -> (key * 'a) Js.undefined
val getUndefined : 'a t -> key -> 'a Js.undefined
val checkInvariantInternal : _ t -> unit
raise when invariant is not held
set m x y
do the in-place modification, return m
for chaining. If x
was already bound in m
, its previous binding disappears.
val updateU : 'a t -> key -> ('a option -> 'a option) Js.Fn.arity1 -> unit
val mapU : 'a t -> ('a -> 'b) Js.Fn.arity1 -> 'b t
map 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 : 'a t -> (key -> 'a -> 'b) Js.Fn.arity2 -> 'b t