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
whenTrueFn function with the same argument. If the predicate is not
satisfied, the argument is returned as is.
A predicate function
A function to invoke when the
evaluates to a truthy value.
An object to test with the
pred function and
whenTrueFn if necessary.
Either `x` or the result of applying `x` to `whenTrueFn`.