Function zipArraysLongest

  • Zip a collection of arrays to create an array of tuples from matching indices. Use the length of the longest array for the output, filling the rest with the provided value.

    Returns

    the zipped array

    Note

    the zipped array has the length of the longest input array

    Example

    zipArraysLongest(null, [1, 2, 3], ['a', 'b', 'c']) === [[1, 'a'], [2, 'b'], [3, 'c']]
    

    Example

    zipArraysLongest(null, [1], ['a', 'b', 'c']) === [[1, 'a'], [null, 'b'], [null, 'c']]
    

    Type Parameters

    • TArrs extends unknown[][]

    • TFill

    Parameters

    • fill: TFill

      the value to fill empty indices with.

    • Rest ...arrays: TArrs

    Returns ZippedLongest<TFill, TArrs>

Generated using TypeDoc