Skip to content

Instantly share code, notes, and snippets.

@MD4
Last active July 20, 2016 13:23
Show Gist options
  • Save MD4/5fc2de90b2f4097d6459d5c154e681b8 to your computer and use it in GitHub Desktop.
Save MD4/5fc2de90b2f4097d6459d5c154e681b8 to your computer and use it in GitHub Desktop.
🐒 Better promise.series simple implementation ! It now gives the result array.
'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