exitIf
The exitIf() function tests a value with a predicate and exits the running flow when the predicate returns true. Because exit effects are forwarded through F.exec(), it can stop a flow from deep nested levels.
Interactive example
Syntax
typescript
function exitIf<
GenericValue extends unknown
>(
value: GenericValue,
thePredicate: (value: GenericValue) => boolean
): Generator<Exit<GenericValue>, GenericValue>Parameters
value: The value to test.thePredicate: Predicate used to decide whether the running flow must exit.
Return value
A generator that yields an exit effect when the predicate returns true, otherwise returns the original value.
