Last active
September 27, 2017 00:43
-
-
Save joedski/786d1c63e9559c9fe72def1e4dcbf7df to your computer and use it in GitHub Desktop.
comp-undo-steps 1: An example process.
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 = | |
stepA(optionsA)( | |
stepB(optionsB)( | |
stepC(optionsC)( | |
// A SACRIFICE TO THE PYRAMID OF DOOM | |
// On a more serious note, since each step function requires | |
// a next function, we need to pass in a "return" function which | |
// doesn't expect a next function to complete the chain. | |
// If we didn't do this, stepC would return a function expecting a next | |
// function... passing that function an object doesn't cause an error, | |
// but it also doesn't result in stepC even running. | |
res => res | |
) | |
) | |
); | |
async function handleSomeThing(ctx) { | |
const resultPctx = await processFoo(ctx); | |
return resultPctx.resultFoo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment