Share your code. Components are building blocks, you are the architect.

utils/both
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
A function which calls the two provided functions and returns the `&&`

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/both in your project
npm i @bit/bit.ramda.utils.both
Copied

both (f:Function, g:Function) : Function

A function which calls the two provided functions and returns the && of the results. It returns the result of the first function if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning that the second function will not be invoked if the first returns a false-y value.

In addition to functions, R.both also accepts any fantasy-land compatible applicative functor.

Example

var gt10 = R.gt(R.__, 10)
     var lt20 = R.lt(R.__, 20)
     var f = R.both(gt10, lt20);
     f(15); //=> true
     f(30); //=> false

     R.both(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(false)
     R.both([false, false, 'a'], [11]); //=> [false, false, 11]

Arguments

f: Function

A predicate

g: Function

Another predicate

Returns

Function

a function that applies its arguments to `f` and `g` and `&&`s their outputs together.