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.
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
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.
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 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.
Returns a result of a
merged into b
.
b
is always the 'newer' data that takes
precedence.
Functions for working with map data structures