MutableMap
The top level provides generic mutable map operations.
It also has two specialized inner modules
Belt.MutableMap.Int and Belt.MutableMap.String
checkInvariantInternal
let checkInvariantInternal: t<'a, 'b, 'c> => unitThrow when invariant is not held.
clear
let clear: t<'a, 'b, 'c> => unitcmp
let cmp: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => int) => intcmp(m1, m2, cmp) First compare by size, if size is the same, compare by
key, value pair.
cmpU
Deprecated
Use cmp instead
let cmpU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => int) => inteq
let eq: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => bool) => booleq(m1, m2, eqf) tests whether the maps m1 and m2 are equal, that is,
contain equal keys and associate them with equal data. eqf is the
equality predicate used to compare the data associated with the keys.
eqU
Deprecated
Use eq instead
let eqU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => bool) => boolevery
let every: (t<'k, 'a, 'id>, ('k, 'a) => bool) => boolevery(m, p) checks if all the bindings of the map satisfy the predicate p.
everyU
Deprecated
Use every instead
let everyU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => boolforEach
let forEach: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unitforEach(m, f) applies f to all bindings in map m. f receives the 'k
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.
forEachU
Deprecated
Use forEach instead
let forEachU: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unitfromArray
let fromArray: (array<('k, 'a)>, ~id: id<'k, 'id>) => t<'k, 'a, 'id>get
let get: (t<'k, 'a, 'id>, 'k) => option<'a>getExn
let getExn: (t<'k, 'a, 'id>, 'k) => 'agetOrThrow
let getOrThrow: (t<'k, 'a, 'id>, 'k) => 'agetUndefined
let getUndefined: (t<'k, 'a, 'id>, 'k) => Js.undefined<'a>getWithDefault
let getWithDefault: (t<'k, 'a, 'id>, 'k, 'a) => 'ahas
let has: (t<'k, 'a, 'b>, 'k) => boolid
type id<'key, 'id> = Belt_Id.comparable<'key, 'id>isEmpty
let isEmpty: t<'a, 'b, 'c> => boolkeysToArray
let keysToArray: t<'k, 'a, 'b> => array<'k>make
let make: (~id: id<'k, 'id>) => t<'k, 'a, 'id>map
let map: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>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.
mapU
Deprecated
Use map instead
let mapU: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>mapWithKey
let mapWithKey: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>mapWithKeyU
Deprecated
Use mapWithKey instead
let mapWithKeyU: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>maximum
let maximum: t<'k, 'a, 'b> => option<('k, 'a)>maxKey
let maxKey: t<'k, 'a, 'b> => option<'k>maxKeyUndefined
let maxKeyUndefined: t<'k, 'a, 'b> => Js.undefined<'k>maxUndefined
let maxUndefined: t<'k, 'a, 'b> => Js.undefined<('k, 'a)>mergeMany
let mergeMany: (t<'k, 'a, 'id>, array<('k, 'a)>) => unitminimum
let minimum: t<'k, 'a, 'b> => option<('k, 'a)>minKey
let minKey: t<'k, 'a, 'b> => option<'k>minKeyUndefined
let minKeyUndefined: t<'k, 'a, 'b> => Js.undefined<'k>minUndefined
let minUndefined: t<'k, 'a, 'b> => Js.undefined<('k, 'a)>reduce
let reduce: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'breduce(m, a, f), computes(f(kN, dN) ... (f(k1, d1, a))...), wherek1 ...
kNare the keys of all bindings inm(in increasing order), andd1 ... dN`
are the associated data.
reduceU
Deprecated
Use reduce instead
let reduceU: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'bremove
let remove: (t<'k, 'a, 'id>, 'k) => unitremove(m, x) do the in-place modification.
removeMany
let removeMany: (t<'k, 'a, 'id>, array<'k>) => unitset
let set: (t<'k, 'a, 'id>, 'k, 'a) => unitset(m, x, y) do the in-place modification
size
let size: t<'k, 'a, 'id> => intsome
let some: (t<'k, 'a, 'id>, ('k, 'a) => bool) => boolsome(m, p) checks if at least one binding of the map satisfy the predicate p.
someU
Deprecated
Use some instead
let someU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => boolt
type t<'k, 'v, 'id>toArray
let toArray: t<'k, 'a, 'id> => array<('k, 'a)>toList
let toList: t<'k, 'a, 'id> => list<('k, 'a)>In increasing order.
update
let update: (t<'k, 'a, 'id>, 'k, option<'a> => option<'a>) => unitupdateU
Deprecated
Use update instead
let updateU: (t<'k, 'a, 'id>, 'k, option<'a> => option<'a>) => unitvaluesToArray
let valuesToArray: t<'b, 'a, 'c> => array<'a>