Last active
September 27, 2017 01:15
-
-
Save joedski/6a3887d67d17a0370012e484334ca263 to your computer and use it in GitHub Desktop.
comp-undo-steps 2: Using compose to flatten things out.
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
const processFoo = compose( | |
stepA(optionsA), | |
stepB(optionsB), | |
stepC(optionsC) | |
)(res => res); | |
async function handleSomeThing(ctx) { | |
// Create a pctx with the original ctx and whatever else we want. | |
// NOTE: in this case, we're trying to not pollute the original ctx, | |
// which might be something like a Koa Context. | |
const pctx = { ctx }; | |
const resultPctx = await processFoo(pctx); | |
return resultPctx.resultFoo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment