source: trip-planner-front/node_modules/lodash/isSafeInteger.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 949 bytes
Line 
1var isInteger = require('./isInteger');
2
3/** Used as references for various `Number` constants. */
4var MAX_SAFE_INTEGER = 9007199254740991;
5
6/**
7 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
8 * double precision number which isn't the result of a rounded unsafe integer.
9 *
10 * **Note:** This method is based on
11 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
12 *
13 * @static
14 * @memberOf _
15 * @since 4.0.0
16 * @category Lang
17 * @param {*} value The value to check.
18 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
19 * @example
20 *
21 * _.isSafeInteger(3);
22 * // => true
23 *
24 * _.isSafeInteger(Number.MIN_VALUE);
25 * // => false
26 *
27 * _.isSafeInteger(Infinity);
28 * // => false
29 *
30 * _.isSafeInteger('3');
31 * // => false
32 */
33function isSafeInteger(value) {
34 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
35}
36
37module.exports = isSafeInteger;
Note: See TracBrowser for help on using the repository browser.