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

utils/either
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
A function wrapping calls to the two functions in an `||` operation,

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/either in your project
npm i @bit/bit.ramda.utils.either
Copied

either (f:Function, g:Function) : Function

A function wrapping calls to the two functions in an || operation, returning the result of the first function if it is truth-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 truth-y value.

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

Example

var gt10 = x => x > 10;
     var even = x => x % 2 === 0;
     var f = R.either(gt10, even);
     f(101); //=> true
     f(8); //=> true

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

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.