Skip to content

Instantly share code, notes, and snippets.

@joedski
Last active September 27, 2017 00:43
Show Gist options
  • Save joedski/786d1c63e9559c9fe72def1e4dcbf7df to your computer and use it in GitHub Desktop.
Save joedski/786d1c63e9559c9fe72def1e4dcbf7df to your computer and use it in GitHub Desktop.
comp-undo-steps 1: An example process.
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