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.
340 B · 13 lines
JavaScript
1234567891011121314export default function asyncMapStrict(arr, fn) { return new Promise((resolve) => { const result = []; arr.reduce( (promise, cur, idx) => promise .then(() => fn(cur, idx, arr) .then((res) => { result.push(res); })), Promise.resolve(), ).then(() => resolve(result)); });}