Last active
September 19, 2015 16:02
-
-
Save dtipson/dfde2a8e721d194a1f70 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var bindP = function(promise, f) { | |
| input.then(function(x) { | |
| return f(x); | |
| }); | |
| }; | |
| //ok, this is better | |
| var bindP = function(promise, f) { | |
| input.then(f); | |
| }; | |
| var pipeP = function(starting_promise, functions) { | |
| for (var i = 0, n = functions.length; i < n; i++) { | |
| starting_promise = bind(starting_promise, functions[i]); | |
| } | |
| return starting_promise; | |
| }; | |
| var sequenceP = function(){ //list of functions as arguments | |
| var fnlist_as_args = arguments; | |
| return function(starting_promise){ | |
| return pipeP(starting_promise,fnlist_as_args); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment