Skip to content

Instantly share code, notes, and snippets.

@mg
Created September 5, 2015 18:25
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 mg/d39d654e60c2a5893861 to your computer and use it in GitHub Desktop.
Save mg/d39d654e60c2a5893861 to your computer and use it in GitHub Desktop.
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