ixfx
    Preparing search index...

    Namespace Maps

    Functions for working with map data structures

    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.

    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

    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.

    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.

    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.

    Type Aliases

    GetOrGenerate
    MergeReconcile

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