ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
20 lines (19 loc) • 527 B
JavaScript
import { defaultTo } from 'ramda';
/**
* Returns the argument if it is not null, undefined or NaN; otherwise number one is returned.
*
* @func
* @category Logic
*
* @example
*
* R_.defaultToOne(null); //=> 1
* R_.defaultToOne(undefined); //=> 1
* R_.defaultToOne('Ramda'); //=> 'Ramda'
* // parseInt('string') results in NaN
* R_.defaultToOne(parseInt('string')); //=> 1
*
* @sig a -> a | Number
*/
var defaultToOne = /*#__PURE__*/defaultTo(1);
export default defaultToOne;