Function zip

  • Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. Zip elements up to the array with the min length.

    Type Parameters

    • LeftItem

      Type of the left array elements.

    • RightItem

      Type of the right array elements.

    Parameters

    • left: LeftItem[]

      The first array to process.

    • right: RightItem[]

      The second array to process.

    Returns [LeftItem, RightItem][]

    Returns the new array of grouped elements.

    Example

    zip([1, 2, 3], ['a', 'b', 'c']);
    // => [[1, 'a'], [2, 'b'], [3, 'c']]

Generated using TypeDoc