Created
August 27, 2018 14:29
-
-
Save EightArmCode/1411d9fca83ab6c13ab3a46da47ad63a to your computer and use it in GitHub Desktop.
fakePromiseAll catches rejected promises to complete all promises and collect errors
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
function fakePromiseAll(arr) { | |
return Promise.all(arr.map(item => { | |
return item.then( | |
result => { | |
return result; | |
}, | |
error => { | |
return error; | |
} | |
); | |
})); | |
} | |
module.exports = fakePromiseAll; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment