Function zip

  • Zips values together by index, into an array, while all sources continue emitting.

    import {pipe, zip} from 'iter-ops';

    const i = pipe(
    [1, 2, 3],
    zip('hello') // <- any number of arguments
    );

    console.log(...i); //=> [1, 'h'], [2, 'e'], [3, 'l']

    The operator takes any number of iterable or iterator arguments.

    Type Parameters

    • T

    • A

    Parameters

    Returns Operation<T, [T, A]>

    Throws

    TypeError: 'Value at index X is not iterable: ...' when a non-iterable value encountered.