@szilanor/stream
    Preparing search index...

    Function zipAsync

    • Returns an AsyncStream that merges elements from both iterables by taking one element from each, passing them to the function, and yielding the result.

      Type Parameters

      • A

        Type of items in the first iterable.

      • B

        Type of items in the second iterable.

      • O

        Type of items in the result.

      Parameters

      • a: AsyncIterable<A>

        First iterable to zip.

      • b: AsyncIterable<B>

        Second iterable to zip.

      • zipFunction: (a: A, b: B) => O

        Function to merge elements from both iterables.

      Returns AsyncStream<O>

      AsyncStream that yields elements of the zipped iterables.

      const result = zipAsync<number, number, number>([1, 2, 3], [4, 5, 6], (a, b) => a + b);
      console.log(result); // [5, 7, 9]