when
v0.9.6arrow_drop_downv0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
923 B
Tests the final argument by passing it to the given predicate function.
1 contributor
Like
Install when as a package?
Copied
npm i @bit/justin-capalbo.ramda.when
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
when (
pred:
Function
,whenTrueFn:
Function
,x:
) : *
*
Tests the final argument by passing it to the given predicate function. If
the predicate is satisfied, the function will return the result of calling
the whenTrueFn
function with the same argument. If the predicate is not
satisfied, the argument is returned as is.
Example
Arguments
pred:
Function
A predicate function
whenTrueFn:
Function
A function to invoke when the condition
evaluates to a truthy value.
x:
*
An object to test with the pred
function and
pass to whenTrueFn
if necessary.
Returns
*
Either `x` or the result of applying `x` to `whenTrueFn`.