iter-tools-es
Version:
The iterable toolbox
17 lines (14 loc) • 392 B
JavaScript
const {
asyncIterableCurry
} = require('../../internal/async-iterable.js');
async function __asyncForEach(iterable, callback) {
let c = 0;
for await (const value of iterable) {
await callback(value, c++);
}
}
exports.__asyncForEach = __asyncForEach;
const asyncForEach = /*#__PURE__*/asyncIterableCurry(__asyncForEach, {
reduces: true
});
exports.asyncForEach = asyncForEach;