mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Remove isFinite and isNaN.
This commit is contained in:
34
isFinite.js
34
isFinite.js
@@ -1,34 +0,0 @@
|
|||||||
import root from './.internal/root.js';
|
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
||||||
const nativeIsFinite = root.isFinite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if `value` is a finite primitive number.
|
|
||||||
*
|
|
||||||
* **Note:** This method is based on
|
|
||||||
* [`Number.isFinite`](https://mdn.io/Number/isFinite).
|
|
||||||
*
|
|
||||||
* @since 0.1.0
|
|
||||||
* @category Lang
|
|
||||||
* @param {*} value The value to check.
|
|
||||||
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* isFinite(3);
|
|
||||||
* // => true
|
|
||||||
*
|
|
||||||
* isFinite(Number.MIN_VALUE);
|
|
||||||
* // => true
|
|
||||||
*
|
|
||||||
* isFinite(Infinity);
|
|
||||||
* // => false
|
|
||||||
*
|
|
||||||
* isFinite('3');
|
|
||||||
* // => false
|
|
||||||
*/
|
|
||||||
function isFinite(value) {
|
|
||||||
return typeof value == 'number' && nativeIsFinite(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default isFinite;
|
|
||||||
36
isNaN.js
36
isNaN.js
@@ -1,36 +0,0 @@
|
|||||||
import isNumber from './isNumber.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if `value` is `NaN`.
|
|
||||||
*
|
|
||||||
* **Note:** This method is based on
|
|
||||||
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
|
|
||||||
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
|
|
||||||
* `undefined` and other non-number values.
|
|
||||||
*
|
|
||||||
* @since 0.1.0
|
|
||||||
* @category Lang
|
|
||||||
* @param {*} value The value to check.
|
|
||||||
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* isNaN(NaN);
|
|
||||||
* // => true
|
|
||||||
*
|
|
||||||
* isNaN(new Number(NaN));
|
|
||||||
* // => true
|
|
||||||
*
|
|
||||||
* isNaN(undefined);
|
|
||||||
* // => true
|
|
||||||
*
|
|
||||||
* isNaN(undefined);
|
|
||||||
* // => false
|
|
||||||
*/
|
|
||||||
function isNaN(value) {
|
|
||||||
// An `NaN` primitive is the only value that is not equal to itself.
|
|
||||||
// Perform the `toStringTag` check first to avoid errors with some
|
|
||||||
// ActiveX objects in IE.
|
|
||||||
return isNumber(value) && value != +value;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default isNaN;
|
|
||||||
@@ -5,7 +5,7 @@ import isObjectLike from './isObjectLike.js';
|
|||||||
* Checks if `value` is classified as a `Number` primitive or object.
|
* Checks if `value` is classified as a `Number` primitive or object.
|
||||||
*
|
*
|
||||||
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
||||||
* classified as numbers, use the `isFinite` method.
|
* classified as numbers, use the `Number.isFinite` method.
|
||||||
*
|
*
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Lang
|
* @category Lang
|
||||||
|
|||||||
Reference in New Issue
Block a user