main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
884 bytes
|
Line | |
---|
1 | import baseGetTag from './_baseGetTag.js';
|
---|
2 | import isObjectLike from './isObjectLike.js';
|
---|
3 |
|
---|
4 | /** `Object#toString` result references. */
|
---|
5 | var numberTag = '[object Number]';
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Checks if `value` is classified as a `Number` primitive or object.
|
---|
9 | *
|
---|
10 | * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
---|
11 | * classified as numbers, use the `_.isFinite` method.
|
---|
12 | *
|
---|
13 | * @static
|
---|
14 | * @memberOf _
|
---|
15 | * @since 0.1.0
|
---|
16 | * @category Lang
|
---|
17 | * @param {*} value The value to check.
|
---|
18 | * @returns {boolean} Returns `true` if `value` is a number, else `false`.
|
---|
19 | * @example
|
---|
20 | *
|
---|
21 | * _.isNumber(3);
|
---|
22 | * // => true
|
---|
23 | *
|
---|
24 | * _.isNumber(Number.MIN_VALUE);
|
---|
25 | * // => true
|
---|
26 | *
|
---|
27 | * _.isNumber(Infinity);
|
---|
28 | * // => true
|
---|
29 | *
|
---|
30 | * _.isNumber('3');
|
---|
31 | * // => false
|
---|
32 | */
|
---|
33 | function isNumber(value) {
|
---|
34 | return typeof value == 'number' ||
|
---|
35 | (isObjectLike(value) && baseGetTag(value) == numberTag);
|
---|
36 | }
|
---|
37 |
|
---|
38 | export default isNumber;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.