Created
September 5, 2015 18:25
-
-
Save mg/d39d654e60c2a5893861 to your computer and use it in GitHub Desktop.
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
let promises= [...] | |
function wrap(inner) { | |
let outer= new Promise() | |
inner.then(result => { | |
outer.resolve(result) | |
}).catch(error) { | |
outer.resolve(error) | |
} | |
return outer | |
} | |
Promise.all(promises.map(promise => return wrap(promise)).then(result => { | |
// ALL RESOLVED | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment