Last active
August 29, 2015 14:14
-
-
Save sebinsua/3be8a7e235180e24ad7c to your computer and use it in GitHub Desktop.
Use of Ramda with Bluebird
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
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now seems to be called
pipeP()
.