Skip to content

Instantly share code, notes, and snippets.

@dtipson
Last active September 19, 2015 16:02
Show Gist options
  • Select an option

  • Save dtipson/dfde2a8e721d194a1f70 to your computer and use it in GitHub Desktop.

Select an option

Save dtipson/dfde2a8e721d194a1f70 to your computer and use it in GitHub Desktop.
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