MutableMap

Belt.MutableMap

The top level provides generic mutable map operations.

It also has two specialized inner modules Belt.MutableMap.Int and Belt.MutableMap.String

checkInvariantInternal

RESCRIPT
let checkInvariantInternal: t<'a, 'b, 'c> => unit

Throw when invariant is not held.

clear

RESCRIPT
let clear: t<'a, 'b, 'c> => unit

cmp

RESCRIPT
let cmp: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => int) => int

cmp(m1, m2, cmp) First compare by size, if size is the same, compare by key, value pair.

cmpU

Deprecated

Use cmp instead

RESCRIPT
let cmpU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => int) => int

eq

RESCRIPT
let eq: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => bool) => bool

eq(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

RESCRIPT
let eqU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => bool) => bool

every

RESCRIPT
let every: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool

every(m, p) checks if all the bindings of the map satisfy the predicate p.

everyU

Deprecated

Use every instead

RESCRIPT
let everyU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool

forEach

RESCRIPT
let forEach: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unit

forEach(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

RESCRIPT
let forEachU: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unit

fromArray

RESCRIPT
let fromArray: (array<('k, 'a)>, ~id: id<'k, 'id>) => t<'k, 'a, 'id>

get

RESCRIPT
let get: (t<'k, 'a, 'id>, 'k) => option<'a>

getExn

RESCRIPT
let getExn: (t<'k, 'a, 'id>, 'k) => 'a

getOrThrow

RESCRIPT
let getOrThrow: (t<'k, 'a, 'id>, 'k) => 'a

getUndefined

RESCRIPT
let getUndefined: (t<'k, 'a, 'id>, 'k) => Js.undefined<'a>

getWithDefault

RESCRIPT
let getWithDefault: (t<'k, 'a, 'id>, 'k, 'a) => 'a

has

RESCRIPT
let has: (t<'k, 'a, 'b>, 'k) => bool

id

RESCRIPT
type id<'key, 'id> = Belt_Id.comparable<'key, 'id>

isEmpty

RESCRIPT
let isEmpty: t<'a, 'b, 'c> => bool

keysToArray

RESCRIPT
let keysToArray: t<'k, 'a, 'b> => array<'k>

make

RESCRIPT
let make: (~id: id<'k, 'id>) => t<'k, 'a, 'id>

map

RESCRIPT
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

RESCRIPT
let mapU: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>

mapWithKey

RESCRIPT
let mapWithKey: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>

mapWithKeyU

Deprecated

Use mapWithKey instead

RESCRIPT
let mapWithKeyU: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>

maximum

RESCRIPT
let maximum: t<'k, 'a, 'b> => option<('k, 'a)>

maxKey

RESCRIPT
let maxKey: t<'k, 'a, 'b> => option<'k>

maxKeyUndefined

RESCRIPT
let maxKeyUndefined: t<'k, 'a, 'b> => Js.undefined<'k>

maxUndefined

RESCRIPT
let maxUndefined: t<'k, 'a, 'b> => Js.undefined<('k, 'a)>

mergeMany

RESCRIPT
let mergeMany: (t<'k, 'a, 'id>, array<('k, 'a)>) => unit

minimum

RESCRIPT
let minimum: t<'k, 'a, 'b> => option<('k, 'a)>

minKey

RESCRIPT
let minKey: t<'k, 'a, 'b> => option<'k>

minKeyUndefined

RESCRIPT
let minKeyUndefined: t<'k, 'a, 'b> => Js.undefined<'k>

minUndefined

RESCRIPT
let minUndefined: t<'k, 'a, 'b> => Js.undefined<('k, 'a)>

reduce

RESCRIPT
let reduce: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'b

reduce(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

RESCRIPT
let reduceU: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'b

remove

RESCRIPT
let remove: (t<'k, 'a, 'id>, 'k) => unit

remove(m, x) do the in-place modification.

removeMany

RESCRIPT
let removeMany: (t<'k, 'a, 'id>, array<'k>) => unit

set

RESCRIPT
let set: (t<'k, 'a, 'id>, 'k, 'a) => unit

set(m, x, y) do the in-place modification

size

RESCRIPT
let size: t<'k, 'a, 'id> => int

some

RESCRIPT
let some: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool

some(m, p) checks if at least one binding of the map satisfy the predicate p.

someU

Deprecated

Use some instead

RESCRIPT
let someU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool

t

RESCRIPT
type t<'k, 'v, 'id>

toArray

RESCRIPT
let toArray: t<'k, 'a, 'id> => array<('k, 'a)>

toList

RESCRIPT
let toList: t<'k, 'a, 'id> => list<('k, 'a)>

In increasing order.

update

RESCRIPT
let update: (t<'k, 'a, 'id>, 'k, option<'a> => option<'a>) => unit

updateU

Deprecated

Use update instead

RESCRIPT
let updateU: (t<'k, 'a, 'id>, 'k, option<'a> => option<'a>) => unit

valuesToArray

RESCRIPT
let valuesToArray: t<'b, 'a, 'c> => array<'a>