Skip to content

Instantly share code, notes, and snippets.

@joedski
Last active September 27, 2017 01:22
Show Gist options
  • Save joedski/feb637c49dad84b4c9e16807332840b0 to your computer and use it in GitHub Desktop.
Save joedski/feb637c49dad84b4c9e16807332840b0 to your computer and use it in GitHub Desktop.
comp-undo-steps 3: Instead of using an identity function to cap things off, use an unboxing/result-extracting function.
function handleSomeThing(ctx) {
return compose(
stepA(optionsA),
stepB(optionsB),
stepC(optionsC),
)(pctx => pctx.resultFoo)({ ctx });
}
// Or somewhat more mysterious looking...
const handleSomeThing = compose(
// the Process Context boxing-up function.
next => ctx => next({ ctx }),
stepA(optionsA),
stepB(optionsB),
stepC(optionsC),
)(pctx => pctx.resultFoo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment