Workflow.branch()
The .branch() method creates conditional branches between workflow steps, allowing for different paths to be taken based on the result of a previous step.
Usage exampleDirect link to Usage example
workflow.branch([
[async ({ context }) => true, step1],
[async ({ context }) => false, step2],
]);
ParametersDirect link to Parameters
steps:
[() => boolean, Step]
An array of tuples, each containing a condition function and a step to execute if the condition is true
ReturnsDirect link to Returns
workflow:
NewWorkflow
The workflow instance for method chaining