Created
November 6, 2015 21:35
-
-
Save dtipson/676cce1398be3894085f to your computer and use it in GitHub Desktop.
Enhanced Pipe Promise #2
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
| //alternatively, creating a custom reduce operation that explicitly wraps the accumulator, then gets curried | |
| const pipePromise2 = R.curry( | |
| (list,acc) => list.reduce( (acc,fn) => acc.then(fn), Promise.resolve(acc) ) | |
| ); | |
| //then, since we made our own reduce with the arguments how we wanted them, no need to R.flip | |
| const program = R.compose( pipePromise2, R.unapply(R.flatten) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment