Skip to main content

Variable: zipConcur()

const zipConcur: <Values>(...iterables) => ConcurIterable<Values>

Defined in: splices.d.ts:1464

Returns a concur iterable that pairs up same-index values, in iteration order, from the given iterables into tuples.

The iterables are iterated in parallel until the shortest one is done, at which point the returned concur iterable is done.

WARNING: If one of the concur iterables yields values more quickly than others, then an unbounded number of its values will be buffered so that they can be yielded with the values of other concur iterables at the same index.

Type Parameters​

Values​

Values extends unknown[] | []

Parameters​

iterables​

...Readonly<{ [Key in keyof Values]: Iterable<Values[Key]> | AsyncIterable<Values[Key]> | ConcurIterable<Values[Key]> }>

Returns​

ConcurIterable<Values>

Example​

console.log(
await pipe(
zipConcur(
asAsync([1, 2, 3, 4]),
[5, `sloth`, 7],
asConcur([8, 9, 10]),
),
reduceConcur(toArray()),
),
)
//=> [ [ 1, 5, 8 ], [ 2, 'sloth', 9 ], [ 3, 7, 10 ] ]

Since​

v3.8.0