breakIf
The breakIf() function tests a value with a predicate and breaks the current flow branch when the predicate returns true. If the predicate fails, the value is returned and the flow continues.
Interactive example
Syntax
typescript
function breakIf<
GenericValue extends unknown
>(
value: GenericValue,
thePredicate: (value: GenericValue) => boolean
): Generator<Break<GenericValue>, GenericValue>Parameters
value: The value to test.thePredicate: Predicate used to decide whether the current branch must stop.
Return value
A generator that yields a break effect when the predicate returns true, otherwise returns the original value.
