Last active
July 20, 2016 13:23
-
-
Save MD4/5fc2de90b2f4097d6459d5c154e681b8 to your computer and use it in GitHub Desktop.
🐒 Better promise.series simple implementation ! It now gives the result array.
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
'use strict'; | |
Promise.series = promises => | |
((results = []) => | |
promises | |
.reduce( | |
(promise, current) => promise | |
.then(current) | |
.then(function () { | |
results.push(arguments); | |
return results | |
}), | |
Promise.resolve() | |
))(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment