source: trip-planner-front/node_modules/lodash/_isIndex.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: 759 bytes
Line 
1/** Used as references for various `Number` constants. */
2var MAX_SAFE_INTEGER = 9007199254740991;
3
4/** Used to detect unsigned integer values. */
5var reIsUint = /^(?:0|[1-9]\d*)$/;
6
7/**
8 * Checks if `value` is a valid array-like index.
9 *
10 * @private
11 * @param {*} value The value to check.
12 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
13 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
14 */
15function isIndex(value, length) {
16 var type = typeof value;
17 length = length == null ? MAX_SAFE_INTEGER : length;
18
19 return !!length &&
20 (type == 'number' ||
21 (type != 'symbol' && reIsUint.test(value))) &&
22 (value > -1 && value % 1 == 0 && value < length);
23}
24
25module.exports = isIndex;
Note: See TracBrowser for help on using the repository browser.