Skip to content

Instantly share code, notes, and snippets.

@myndzi
Created March 30, 2017 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myndzi/b00ee9cc4fe83cc917a279b788dec9cf to your computer and use it in GitHub Desktop.
Save myndzi/b00ee9cc4fe83cc917a279b788dec9cf to your computer and use it in GitHub Desktop.
function sequentially(array, promiseFn) {
return array.reduce((acc, current) =>
acc.then(results =>
promiseFn(current).then(res =>
results.concat(res)
)
)
, Promise.resolve([]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment