both

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
3 KB
A function which calls the two provided functions and returns the `&&` of the results.
1 contributor
Install both as a package?
Copied
npm i @bit/justin-capalbo.ramda.both
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
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
const gt10 = R.gt(R.__, 10)
     const lt20 = R.lt(R.__, 20)
     const 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.

Help and resources