UNPKG

791 BJavaScriptView Raw
1import root from './_root.js';
2
3/* Built-in method references for those with the same name as other `lodash` methods. */
4var nativeIsFinite = root.isFinite;
5
6/**
7 * Checks if `value` is a finite primitive number.
8 *
9 * **Note:** This method is based on
10 * [`Number.isFinite`](https://mdn.io/Number/isFinite).
11 *
12 * @static
13 * @memberOf _
14 * @since 0.1.0
15 * @category Lang
16 * @param {*} value The value to check.
17 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
18 * @example
19 *
20 * _.isFinite(3);
21 * // => true
22 *
23 * _.isFinite(Number.MIN_VALUE);
24 * // => true
25 *
26 * _.isFinite(Infinity);
27 * // => false
28 *
29 * _.isFinite('3');
30 * // => false
31 */
32function isFinite(value) {
33 return typeof value == 'number' && nativeIsFinite(value);
34}
35
36export default isFinite;