UNPKG

iterama

Version:

Composable functional (async) iterable helpers

17 lines (13 loc) 303 B
Object.defineProperty(exports, "__esModule", { value: true }); exports.mapAsync = void 0; const mapAsync = mapFn => iterable => ({ async *[Symbol.asyncIterator]() { let i = 0; for await (const value of iterable) { yield mapFn(value, i++); } } }); exports.mapAsync = mapAsync;