ixfx
    Preparing search index...

    Module @ixfx/arrays - v0.46.0

    Contains various functions for working with arrays immutably.

    Functions

    atWrap

    Similar to Javascript's in-built Array.at function, but allows offsets to wrap.

    chunks
    contains

    Returns true if all value in needles is contained in haystack.

    containsDuplicateInstances

    Returns true if array contains duplicate instances based on === equality checking Use containsDuplicateValues if you'd rather compare by value.

    containsDuplicateValues

    Returns true if array contains duplicate values.

    containsIdenticalValues

    Returns true if all values in the array are the same. Uses value-based equality checking by default.

    cycle

    Returns a function that cycles through the contents of an array. By default starts at index 0.

    ensureLength

    Returns a copy of an array with specified length - padded or truncated as needed.

    filterAB

    Returns two separate arrays of everything that filter returns true, and everything it returns false on.

    filterBetween

    Yields elements from array that match a given predicate, and moreover are between the given startIndex (inclusive) and endIndex (exclusive).

    flatten

    Returns a 'flattened' copy of array, un-nesting arrays one level

    frequencyByGroup

    Computes the frequency of values by a grouping function.

    groupBy

    Groups data by a function grouper, returning data as a map with string keys and array values. Multiple values can be assigned to the same group.

    insertAt

    Inserts values at position index, shuffling remaining items further down and returning changed result.

    interleave

    Returns an interleaving of two or more arrays. All arrays must be the same length.

    intersection

    Returns the intersection of two arrays: the elements that are in common.

    isEqual

    Returns true if the two arrays have the same items at same indexes.

    mergeByKey

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

    pairwise

    Yields pairs made up of overlapping items from the input array.

    pairwiseReduce

    Reduces in a pairwise fashion.

    randomElement

    Returns a random element of an array

    randomIndex

    Returns a random array index.

    remove

    Removes an element at index index from data, returning the resulting array without modifying the original.

    sample

    Samples values from an array.

    shuffle

    Returns a shuffled copy of the input array.

    sortByNumericProperty

    Sorts an array of objects in ascending order by the given property name, assuming it is a number.

    sortByProperty

    Sorts an array of objects by some named property.

    unique

    Combines the values of one or more arrays, removing duplicates. Compares based on a string representation of object. Uses a Set to avoid unnecessary comparisons, perhaps faster than uniqueDeep.

    uniqueDeep

    Combines the values of one or more arrays, removing duplicates.

    until

    Yields all items in the input array for as long as predicate returns true.

    without

    Returns an array with value(s) omitted.

    withoutUndefined

    Returns a copy of an input array with undefined values removed.

    zip

    Zip combines the elements of two or more arrays based on their index.

    Type Aliases

    IsEqual

    Function that returns true if a and b are considered equal

    MergeReconcile

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