iter-tools-es
Version:
The iterable toolbox
15 lines (12 loc) • 338 B
JavaScript
const {
asyncIterableCurry
} = require('../../internal/async-iterable.js');
async function* __asyncMap(source, func) {
let c = 0;
for await (const value of source) {
yield await func(value, c++);
}
}
exports.__asyncMap = __asyncMap;
const asyncMap = /*#__PURE__*/asyncIterableCurry(__asyncMap);
exports.asyncMap = asyncMap;