UNPKG

iter-tools-es

Version:
24 lines (20 loc) 534 B
const { asyncIterableCurry } = require('../../internal/async-iterable.js'); const { AsyncExchange } = require('../../internal/async-fork.js'); function* __asyncFork(source) { const exchange = new AsyncExchange(source[Symbol.asyncIterator]()); const dummyFork = exchange.fork(); try { while (true) yield exchange.fork(); } finally { dummyFork.return(); } } exports.__asyncFork = __asyncFork; const asyncFork = /*#__PURE__*/asyncIterableCurry(__asyncFork, { forceSync: true }); exports.asyncFork = asyncFork;