ixfx
    Preparing search index...

    Namespace Maps

    Maps associate keys with values.

    Functions

    addObjectEntriesMutate

    Adds an object to an existing map, mutating it. It assumes a structure where each top-level property is a key:

    addValue

    Adds values to a map, returning a new, modified copy and leaving the original intact.

    addValueMutate

    Mutates map, adding each value to it using a function to produce a key. Use addValue for an immutable version.

    addValueMutator

    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.

    deleteByValueCompareMutate

    Deletes all key/values from map where value matches value, with optional comparer. Mutates map.

    expiringMap

    Create a ExpiringMap instance

    filterValues

    Returns values where predicate returns true.

    findBySomeKey

    Returns the first value in data that matches a key from keys.

    findEntryByPredicate

    Finds first entry by iterable value. Expects a map with an iterable as values.

    findEntryByValue

    Finds first entry by value.

    findValue

    Returns the first found value that matches predicate or undefined. To get an entry see findEntryByPredicate

    firstEntry

    Finds first entry by iterable value. Expects a map with an iterable as values.

    firstEntryByValue

    Finds first entry by iterable value. Expects a map with an iterable as values.

    fromIterable

    Returns a Map from an iterable. By default throws an exception if iterable contains duplicate values.

    fromObject

    Returns a Map from an object, or array of objects. Assumes the top-level properties of the object is the key.

    getClosestIntegerKey

    Gets the closest integer key to target in data.

    • Requires map to have numbers as keys, not strings
    • Math.round is used for rounding target.
    getOrGenerate

    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.

    getOrGenerateSync

    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.

    hasAnyValue

    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.

    hasKeyValue

    Returns true if map contains value under key, using comparer function. Use hasAnyValue if you don't care what key value might be under.

    immutable

    Returns an IMapImmutable. Use Maps.mutable as a mutable alternatve.

    lengthMax

    Returns the size of the largest key, or 0 if empty.

    mapToArray

    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.

    mapToObjectTransform

    Converts a map to a simple object, transforming from type T to K as it does so. If no transforms are needed, use toObject.

    mergeByKey

    Merges maps left to right, using the provided reconcile function to choose a winner when keys overlap.

    mutable

    Returns a IMapMutable (which just wraps the in-built Map) Use Maps.immutable for the immutable alternative.

    ofArrayMutable

    Returns a IMapOfMutableExtended to allow storing multiple values under a key, unlike a regular Map.

    ofCircularMutable

    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.

    ofSetMutable

    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.

    ofSimple

    A simple immutable map of arrays, without events. It can store multiple values under the same key.

    ofSimpleMutable

    A simple mutable map of arrays, without events. It can store multiple values under the same key.

    some

    Returns true if predicate yields true for any value in map. Use findValue if you want the matched value.

    sortByValue

    Returns a array of entries from a map, sorted by value.

    sortByValueProperty

    Returns an array of entries from a map, sorted by a property of the value

    toArray

    Copies data to an array

    toObject

    Converts a Map to a plain object, useful for serializing to JSON. To convert back to a map use fromObject.

    transformMap

    Like Array.map, but for a Map. Transforms from Map<K,V> to Map<K,R>, returning as a new Map.

    zipKeyValue

    Zips together an array of keys and values into an object. Requires that keys and values are the same length.

    Classes

    MapOfMutableImpl
    MapOfSimple

    Simple immutable MapOf

    MapOfSimpleMutable

    A simple mutable map of arrays, without events. It can store multiple values under the same key.

    NumberMap

    Simple map for numbers.

    Interfaces

    IMapImmutable

    An immutable map. Rather than changing the map, functions like add and delete return a new map reference which must be captured.

    IMapMutable

    A mutable map.

    IMapOf
    IMapOfImmutable

    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.

    IMapOfMutable
    IMapOfMutableExtended

    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.

    References

    ExpiringMap → ExpiringMap
    mapOfSimpleMutable → ofSimpleMutable

    Type Aliases

    ExpiringMapEvent

    Event from the ExpiringMap

    ExpiringMapEvents
    ExpiringMapOpts

    Expiring map options

    GetOrGenerate
    MapArrayEvents

    Events from mapArray

    MapArrayOpts

    Map of array options

    MapCircularOpts
    MapMultiOpts
    MapSetOpts
    MergeReconcile

    Returns a result of a merged into b. b is always the 'newer' data that takes precedence.