UNPKG

@thi.ng/transducers-async

Version:

Async versions of various highly composable transducers, reducers and iterators

18 lines (17 loc) 321 B
async function* zip(...src) { const iters = src.map( (s) => s[Symbol.iterator]?.() || s[Symbol.asyncIterator]?.() ); while (true) { const tuple = []; for (let i of iters) { let v = await i.next(); if (v.done) return; tuple.push(v.value); } yield tuple; } } export { zip };