Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
669 bytes
|
Line | |
---|
1 | var toInteger = require('./toInteger');
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Checks if `value` is an integer.
|
---|
5 | *
|
---|
6 | * **Note:** This method is based on
|
---|
7 | * [`Number.isInteger`](https://mdn.io/Number/isInteger).
|
---|
8 | *
|
---|
9 | * @static
|
---|
10 | * @memberOf _
|
---|
11 | * @since 4.0.0
|
---|
12 | * @category Lang
|
---|
13 | * @param {*} value The value to check.
|
---|
14 | * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
|
---|
15 | * @example
|
---|
16 | *
|
---|
17 | * _.isInteger(3);
|
---|
18 | * // => true
|
---|
19 | *
|
---|
20 | * _.isInteger(Number.MIN_VALUE);
|
---|
21 | * // => false
|
---|
22 | *
|
---|
23 | * _.isInteger(Infinity);
|
---|
24 | * // => false
|
---|
25 | *
|
---|
26 | * _.isInteger('3');
|
---|
27 | * // => false
|
---|
28 | */
|
---|
29 | function isInteger(value) {
|
---|
30 | return typeof value == 'number' && value == toInteger(value);
|
---|
31 | }
|
---|
32 |
|
---|
33 | module.exports = isInteger;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.