Skip to content

Instantly share code, notes, and snippets.

@rubystream
Created October 2, 2016 08:10
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 rubystream/fcf8addecb8e14466bb56b294405ea74 to your computer and use it in GitHub Desktop.
Save rubystream/fcf8addecb8e14466bb56b294405ea74 to your computer and use it in GitHub Desktop.
Promise.all vanila
// objectsToProcess - array of objects to process
// asyncFunction - asynct function that take objectsToProcess item as argument and return a promise
Promise.all(objectsToProcess.map(asyncFunction))
.then(values => { console.log(values) })
.catch(reason => { console.log(reason) });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment