Function zip

  • Zips together elements from the input iterables into arrays. Returns a function that accepts an input iterable of iterables and yields arrays of elements from the input iterables, where the first elements of the input iterables are combined, the second elements are combined, and so on.

    The input iterable containing child iterables MUST be synchronous. The child iterables can be either synchronous or asynchronous.

    Returns

    A function that accepts an input iterable of iterables and returns an async iterable.

    Example

    const input = iterable([[1, 2, 3], ['a', 'b', 'c']]);
    const result = await toArray(zip()(input)); // [[1, 'a'], [2, 'b'], [3, 'c']]

    Type Parameters

    • T extends AnyIterable<unknown>

      The type of elements in the input iterable of iterables.

    Returns ((input: Iterable<T>) => AsyncIterable<ElementOf<T>[]>)

      • (input: Iterable<T>): AsyncIterable<ElementOf<T>[]>
      • Parameters

        • input: Iterable<T>

        Returns AsyncIterable<ElementOf<T>[]>

Generated using TypeDoc