Stream.zip<U,F,>(other: Stream<U, F>): Stream<[T, U], E | F>
Combines this stream with another into tuples, yielding one result per pair of values. The shorter stream determines when zipping completes.
Example 1
Example 1
import { Source } from "anabranch"; const stream1 = Source.from<number, never>(async function* () { yield 1; yield 2; yield 3; }); const stream2 = Source.from<string, never>(async function* () { yield "a"; yield "b"; }); const zipped = stream1.zip(stream2); // Emits: { type: "success", value: [1, "a"] }, { type: "success", value: [2, "b"] }