From fc1a36021247034127908b18d6fc912e339990d7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 10 Jan 2017 14:44:07 -0800 Subject: [PATCH] Remove `isFinite` and `isNaN`. --- isFinite.js | 34 ---------------------------------- isNaN.js | 36 ------------------------------------ isNumber.js | 2 +- 3 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 isFinite.js delete mode 100644 isNaN.js diff --git a/isFinite.js b/isFinite.js deleted file mode 100644 index c272bd4ae..000000000 --- a/isFinite.js +++ /dev/null @@ -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; diff --git a/isNaN.js b/isNaN.js deleted file mode 100644 index 4d11b7488..000000000 --- a/isNaN.js +++ /dev/null @@ -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; diff --git a/isNumber.js b/isNumber.js index b9b560a4c..f8db485dd 100644 --- a/isNumber.js +++ b/isNumber.js @@ -5,7 +5,7 @@ import isObjectLike from './isObjectLike.js'; * Checks if `value` is classified as a `Number` primitive or object. * * **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 * @category Lang