ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
33 lines (31 loc) • 1.03 kB
JavaScript
import { bind, curryN } from 'ramda';
import isFunction from './isFunction';
import polyfill from './internal/polyfills/Number.isFinite';
export var isFinitePolyfill = curryN(1, polyfill);
/**
* Checks whether the passed value is a finite `Number`.
*
* @func isFinite
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/0.7.0|v0.7.0}
* @category Type
* @sig * -> Boolean
* @param {*} val The value to test
* @return {boolean}
* @see {@link RA.isNotFinite|isNotFinite}
* @example
*
* RA.isFinite(Infinity); //=> false
* RA.isFinite(NaN); //=> false
* RA.isFinite(-Infinity); //=> false
*
* RA.isFinite(0); // true
* RA.isFinite(2e64); // true
*
* RA.isFinite('0'); // => false
* // would've been true with global isFinite('0')
* RA.isFinite(null); // => false
* // would've been true with global isFinite(null)
*/
var _isFinite = isFunction(Number.isFinite) ? curryN(1, bind(Number.isFinite, Number)) : isFinitePolyfill;
export default _isFinite;