ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
30 lines (26 loc) • 780 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ramda = require("ramda");
var _primitives = require("./internal/primitives");
/**
* Returns the argument if it is not null, undefined or NaN; otherwise the empty array is returned.
*
* @func
* @category Logic
*
* @example
*
* R_.defaultToEmptyArray(null); //=> []
* R_.defaultToEmptyArray(undefined); //=> []
* R_.defaultToEmptyArray('Ramda'); //=> 'Ramda'
* // parseInt('string') results in NaN
* R_.defaultToEmptyArray(parseInt('string')); //=> []
*
* @sig a -> a | Array
*/
var defaultToEmptyArray = (0, _ramda.defaultTo)(_primitives.emptyArray);
var _default = defaultToEmptyArray;
exports.default = _default;