Created
November 25, 2015 23:06
-
-
Save anonymous/1b685c9be8e8164f6b23 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
function all(promises) { | |
return promises.reduce(function (previous, next) { | |
return join(previous, next, function ([previous_results, next_val]) { | |
previous_results.push(next_val); | |
return previous_results; | |
}); | |
}); | |
} | |
function join(x, y) { | |
return x.then(function (x_val) { | |
y.then(function (y_val) { | |
return [x, y]; | |
}) | |
}) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment