Created
December 19, 2013 02:29
-
-
Save robotlolita/8033418 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
[p1, p2, p3, p4].reduce(function(result, current){ | |
return result.then(function(context) { | |
return context.done? context | |
: /* otherwise */ b.then(function(value) { | |
return shouldWeGoOn(value)? { done: false, values: context.concat([value]) } | |
: /* otherwise */ { done: true, values: context } | |
}) | |
}) | |
}, Promise.of({ done: false, values: [] }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment