Skip to content

Instantly share code, notes, and snippets.

@dtipson
Created November 6, 2015 21:35
Show Gist options
  • Select an option

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

Select an option

Save dtipson/676cce1398be3894085f to your computer and use it in GitHub Desktop.
Enhanced Pipe Promise #2
//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