deno.land / x / lodash@4.17.19 / npm-package / _isIndex.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/** Used as references for various `Number` constants. */var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */var reIsUint = /^(?:0|[1-9]\d*)$/;
/** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length;
return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length);}
module.exports = isIndex;
lodash

Version Info

Tagged at
3 years ago

External Dependencies

No external dependencies 🎉