Skip to content

Instantly share code, notes, and snippets.

@niradler
Created May 1, 2019 11:38
Show Gist options
  • Save niradler/d11910835be128165870bbee3e24c3d8 to your computer and use it in GitHub Desktop.
Save niradler/d11910835be128165870bbee3e24c3d8 to your computer and use it in GitHub Desktop.
resolve promises sequentially with reduce.
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