ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
28 lines (25 loc) • 657 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ramda = require("ramda");
/**
* Returns the argument if it is not null, undefined or NaN; otherwise zero is returned.
*
* @func
* @category Logic
*
* @example
*
* R_.defaultToZero(null); //=> 0
* R_.defaultToZero(undefined); //=> 0
* R_.defaultToZero('Ramda'); //=> 'Ramda'
* // parseInt('string') results in NaN
* R_.defaultToZero(parseInt('string')); //=> 0
*
* @sig a -> a | Number
*/
var defaultToZero = (0, _ramda.defaultTo)(0);
var _default = defaultToZero;
exports.default = _default;