when
when<
A,B>(predicate,onTrue): (value) =>A|B
Defined in: Composition/when.ts:20
Executes a function on the piped value if a predicate is met, otherwise returns the value unchanged.
Type Parameters
Section titled “Type Parameters”A
B = A
Parameters
Section titled “Parameters”predicate
Section titled “predicate”(value) => boolean
onTrue
Section titled “onTrue”(value) => B
Returns
Section titled “Returns”(value) => A | B
Example
Section titled “Example”unless for executing when a predicate is not met