Created
October 2, 2016 08:10
-
-
Save rubystream/fcf8addecb8e14466bb56b294405ea74 to your computer and use it in GitHub Desktop.
Promise.all vanila
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
// 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