Async reduce
scriptex opened this issue · 1 comments
scriptex commented
Here is an example implementation:
import { throws } from '../utils';
export const reduceAsync = async function(fn, accumulator, thisArg) {
throws(this, fn);
let result = accumulator;
for (value of this) {
result = await fn.call(thisArg, accumulator, value);
}
return result;
}