when
Call Signature
Section titled “Call Signature”when<
A,B,C>(predicate,onTrue): (value) =>C|Exclude<A,B>
Defined in: Composition/when.ts:19
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
C
Parameters
Section titled “Parameters”predicate
Section titled “predicate”(value) => value is B
onTrue
Section titled “onTrue”(value) => C
Returns
Section titled “Returns”(value) => C | Exclude<A, B>
Example
Section titled “Example”unless for executing when a predicate is not met
Call Signature
Section titled “Call Signature”when<
A,B>(predicate,onTrue): <V>(value) =>B|V
Defined in: Composition/when.ts:23
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”<V>(value) => B | V
Example
Section titled “Example”unless for executing when a predicate is not met