12345678910111213141516171819202122232425 |
- var MAX_SAFE_INTEGER = 9007199254740991;
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- 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);
- }
- export default isIndex;
|