UNPKG

iterama

Version:

Composable functional (async) iterable helpers

18 lines (14 loc) 346 B
Object.defineProperty(exports, "__esModule", { value: true }); exports.forEachAsync = void 0; const forEachAsync = forEachFn => iterable => ({ async *[Symbol.asyncIterator]() { let i = 0; for await (const value of iterable) { await forEachFn(value, i++); yield value; } } }); exports.forEachAsync = forEachAsync;