Skip to content

Instantly share code, notes, and snippets.

@sebinsua
Last active August 29, 2015 14:14
Show Gist options
  • Save sebinsua/3be8a7e235180e24ad7c to your computer and use it in GitHub Desktop.
Save sebinsua/3be8a7e235180e24ad7c to your computer and use it in GitHub Desktop.
Use of Ramda with Bluebird
var Q = require('bluebird'),
R = require('ramda');
var shouldError = false;
var a = function (arg) {
return new Q.Promise(function (resolve, reject) {
resolve("[a] resolved");
});
};
var b = function (arg) {
return new Q.Promise(function (resolve, reject) {
if (shouldError) {
reject("[b] rejected");
} else {
resolve("[b] resolved");
}
});
};
var c = function (arg) {
return new Q.Promise(function (resolve, reject) {
resolve("[c] resolved");
});
};
var steps = R.pPipe(a, b, c);
steps().then(function (finalResponse) {
console.log(finalResponse);
}).catch(function (err) {
console.log(err);
});
@sebinsua
Copy link
Author

Now seems to be called pipeP().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment