iter-tools-es
Version:
The iterable toolbox
19 lines (16 loc) • 508 B
JavaScript
const {
asyncIterableCurry,
asyncCache
} = require('../../internal/async-iterable.js');
async function* __asyncInterposeSeq(source, seq) {
const subseq_ = await asyncCache(seq);
let first = true;
for await (const sourceValue of source) {
if (!first) yield* subseq_;
yield sourceValue;
first = false;
}
}
exports.__asyncInterposeSeq = __asyncInterposeSeq;
const asyncInterposeSeq = /*#__PURE__*/asyncIterableCurry(__asyncInterposeSeq);
exports.asyncInterposeSeq = asyncInterposeSeq;