ts-iterable-functions
    Preparing search index...

    Function _zip

    • Combines two iterables by applying a selector to aligned pairs until either source is exhausted.

      Type Parameters

      • T

        Element type produced by the first iterable.

      • TOther

        Element type produced by the second iterable.

      • TOut

        Element type yielded by the selector.

      Parameters

      • src: Iterable<T>

        Primary iterable providing the first element of each pair.

      • seq: Iterable<TOther>

        Secondary iterable providing the second element of each pair.

      • selector: (item1: T, item2: TOther) => TOut

        Function mapping a pair of elements to the emitted value.

      Returns Iterable<TOut>

      A deferred iterable yielding the selector results for each aligned pair.

      Error Rethrows any error thrown by selector.

      const result = _zip(
      [1, 2],
      ["a", "b"],
      (value, label) => `${value}${label}`
      );
      console.log([...result]); // ["1a", "2b"]

      or using the curried version:

      const result = [
      ...pipeInto(
      [1, 2],
      zip(
      ["a", "b"],
      (value, label) => `${value}${label}`
      )
      ),
      ];
      console.log(result); // ["1a", "2b"]