source: node_modules/ramda-adjunct/src/isFinite.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import { bind, curryN } from 'ramda';
2
3import isFunction from './isFunction';
4import ponyfill from './internal/ponyfills/Number.isFinite';
5
6export const isFinitePonyfill = curryN(1, ponyfill);
7
8/**
9 * Checks whether the passed value is a finite `Number`.
10 *
11 * @func isFinite
12 * @memberOf RA
13 * @since {@link https://char0n.github.io/ramda-adjunct/0.7.0|v0.7.0}
14 * @category Type
15 * @sig * -> Boolean
16 * @param {*} val The value to test
17 * @return {boolean}
18 * @see {@link RA.isNotFinite|isNotFinite}
19 * @example
20 *
21 * RA.isFinite(Infinity); //=> false
22 * RA.isFinite(NaN); //=> false
23 * RA.isFinite(-Infinity); //=> false
24 *
25 * RA.isFinite(0); // true
26 * RA.isFinite(2e64); // true
27 *
28 * RA.isFinite('0'); // => false
29 * // would've been true with global isFinite('0')
30 * RA.isFinite(null); // => false
31 * // would've been true with global isFinite(null)
32 */
33const _isFinite = isFunction(Number.isFinite)
34 ? curryN(1, bind(Number.isFinite, Number))
35 : isFinitePonyfill;
36
37export default _isFinite;
Note: See TracBrowser for help on using the repository browser.