Created
May 1, 2019 11:38
-
-
Save niradler/d11910835be128165870bbee3e24c3d8 to your computer and use it in GitHub Desktop.
resolve promises sequentially with reduce.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resolveSequentially(promisesArray) { | |
return promisesArray.reduce((accumulatorPromise, promise) => { | |
return accumulatorPromise | |
.then(() => { | |
return promise; | |
}) | |
}, Promise.resolve()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment