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

utils/default-to
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
1     DEPENDENCIES
Build: fail
BuildFail
Build Status: fail
Returns the second argument if it is not `null`, `undefined` or `NaN`;

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

defaultTo (default:a, val:b) : *

Returns the second argument if it is not null, undefined or NaN; otherwise the first argument is returned.

Example

var defaultTo42 = R.defaultTo(42);

     defaultTo42(null);  //=> 42
     defaultTo42(undefined);  //=> 42
     defaultTo42('Ramda');  //=> 'Ramda'
     // parseInt('string') results in NaN
     defaultTo42(parseInt('string')); //=> 42

Arguments

default: a

The default value.

val: b

`val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`.

Returns

*

The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value