API / Belt / MutableMap

MutableMap

A mutable sorted map module which allows customize compare behavior.

Same as Belt.Map, but mutable.

t

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

id

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

make

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

clear

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

isEmpty

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

has

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

cmpU

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

cmp

RES
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.

eqU

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

eq

RES
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.

forEachU

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

forEach

RES
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.

reduceU

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

reduce

RES
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.

everyU

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

every

RES
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.

someU

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

some

RES
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.

size

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

toList

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

In increasing order.

toArray

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

fromArray

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

keysToArray

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

valuesToArray

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

minKey

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

minKeyUndefined

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

maxKey

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

maxKeyUndefined

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

minimum

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

minUndefined

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

maximum

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

maxUndefined

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

get

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

getUndefined

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

getWithDefault

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

getExn

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

checkInvariantInternal

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

Raise when invariant is not held.

remove

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

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

removeMany

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

set

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

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

updateU

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

update

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

mergeMany

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

mapU

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

map

RES
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.

mapWithKeyU

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

mapWithKey

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