Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/wojtekmaj/async-array-utils. A collection of array-related async utilities.
array array-methods async promise utils
Something went wrong. Try again.
280 B · 12 lines
JavaScript
12345678910111213export default async function asyncReduce(arr, fn, initialValue) { let temp = initialValue;
for (let idx = 0; idx < arr.length; idx += 1) { const cur = arr[idx];
// eslint-disable-next-line no-await-in-loop temp = await fn(temp, cur, idx); }
return temp;}