method StreamClass.zip
Private
StreamClass.zip<U extends readonly unknown[]>(...sources: [K in keyof U]: Source<U[K]>): StreamClass<
[K in keyof U]: Exclude<U[K], AnyFailure>,
Extract<U[number], AnyFailure>
>

Zips sources in lockstep, ending at the shortest (Elixir's Stream.zip) and closing the longer sources so their cleanup runs. JS divergences: sources are pulled sequentially per slot, and a failure element passes through bare without consuming from the other sources — failures cannot pair.

await Stream.zip([1, 2, 3], ['a', 'b']).collect(); // [[1, 'a'], [2, 'b']]

Type Parameters

U extends readonly unknown[]

Parameters

...sources: [K in keyof U]: Source<U[K]>

Return Type

StreamClass<
[K in keyof U]: Exclude<U[K], AnyFailure>,
Extract<U[number], AnyFailure>
>

Usage

import { StreamClass } from "lib/stream/stream.ts";