- whenFalsy<Value, Predicated>(predicate: Predicate<Value, Predicated>): (<FalseInput, FalseOutput>(falsyHandler: Unary<FalseInput, FalseOutput>) => ((value: Value) => Predicated & Value | FalseOutput))
-
Parameters
-
predicate: Predicate<Value, Predicated>
Returns (<FalseInput, FalseOutput>(falsyHandler: Unary<FalseInput, FalseOutput>) => ((value: Value) => Predicated & Value | FalseOutput))
-
- <FalseInput, FalseOutput>(falsyHandler: Unary<FalseInput, FalseOutput>): ((value: Value) => Predicated & Value | FalseOutput)
-
Type Parameters
-
FalseInput = Value extends Predicated ? Value : Predicated
-
FalseOutput = Predicated & Value
Parameters
-
falsyHandler: Unary<FalseInput, FalseOutput>
Returns ((value: Value) => Predicated & Value | FalseOutput)
-
- (value: Value): Predicated & Value | FalseOutput
-
Returns Predicated & Value | FalseOutput
Like
when
, but when is falsy the value is returned as is.Example
Returns
Curried function with
predicate
in context.