Remove isFinite and isNaN.

This commit is contained in:
John-David Dalton
2017-01-10 14:44:07 -08:00
parent 4ecd69e4fa
commit fc1a360212
3 changed files with 1 additions and 71 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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