Adds an object to an existing map, mutating it. It assumes a structure where each top-level property is a key:
Adds values to a map, returning a new, modified copy and leaving the original intact.
Mutates map
, adding each value to it using a
function to produce a key. Use addValue for an immutable version.
Returns a function that adds values to a map, using a hashing function to produce a key. Use addValueMutate if you don't need a reusable function.
Deletes all key/values from map where value matches value
,
with optional comparer. Mutates map.
Create a ExpiringMap instance
Returns values where predicate
returns true.
Returns the first value in data
that matches a key from keys
.
Finds first entry by iterable value. Expects a map with an iterable as values.
Finds first entry by value.
Returns the first found value that matches predicate
or undefined.
To get an entry see findEntryByPredicate
Finds first entry by iterable value. Expects a map with an iterable as values.
Finds first entry by iterable value. Expects a map with an iterable as values.
Returns a Map from an iterable. By default throws an exception if iterable contains duplicate values.
Returns a Map from an object, or array of objects. Assumes the top-level properties of the object is the key.
Gets the closest integer key to target
in data
.
target
.Returns a function that fetches a value from a map, or generates and sets it if not present.
Undefined is never returned, because if fn
yields that, an error is thrown.
Returns a function that fetches a value from a map, or generates and sets it if not present.
Undefined is never returned, because if fn
yields that, an error is thrown.
Returns true if any key contains value
, based on the provided comparer
function. Use hasKeyValue
if you only want to find a value under a certain key.
Returns true if map contains value
under key
, using comparer
function. Use hasAnyValue if you don't care
what key value might be under.
Returns an IMapImmutable. Use Maps.mutable as a mutable alternatve.
Returns the size of the largest key, or 0 if empty.
Converts Map to Array with a provided transformer
function. Useful for plucking out certain properties
from contained values and for creating a new map based on transformed values from an input map.
Converts a map to a simple object, transforming from type T
to K
as it does so. If no transforms are needed, use toObject.
Merges maps left to right, using the provided
reconcile
function to choose a winner when keys overlap.
Returns a IMapMutable (which just wraps the in-built Map) Use Maps.immutable for the immutable alternative.
Returns a IMapOfMutableExtended to allow storing multiple values under a key, unlike a regular Map.
Returns a IMapOfMutableExtended that uses a ICircularArray to hold values. Mutable. This means that the number of values stored under each key will be limited to the defined capacity.
Returns a IMapOfMutableExtended that uses a set to hold values. This means that only unique values are stored under each key. By default it uses the JSON representation to compare items.
A simple immutable map of arrays, without events. It can store multiple values under the same key.
A simple mutable map of arrays, without events. It can store multiple values under the same key.
Returns true if predicate
yields true for any value in map
.
Use findValue if you want the matched value.
Returns a array of entries from a map, sorted by value.
Returns an array of entries from a map, sorted by a property of the value
Copies data to an array
Converts a Map
to a plain object, useful for serializing to JSON.
To convert back to a map use fromObject.
Like Array.map
, but for a Map. Transforms from Map<K,V> to Map<K,R>, returning as a new Map.
Zips together an array of keys and values into an object. Requires that
keys
and values
are the same length.
Simple immutable MapOf
A simple mutable map of arrays, without events. It can store multiple values under the same key.
Simple map for numbers.
An immutable map. Rather than changing the map, functions like add
and delete
return a new map reference which must be captured.
A mutable map.
Like a Map
but multiple values can be stored for each key. Immutable.
Duplicate values can be added to the same or even a several keys.
Like a Map
but multiple values can be stored for each key.
Duplicate values can be added to the same or even a several keys.
Event from the ExpiringMap
Expiring map options
Events from mapArray
Map of array options
Returns a result of a
merged into b
.
b
is always the 'newer' data that takes
precedence.
Maps associate keys with values.