Sha256: 48275b1bd8820ccd67c736fcd62ec3f9a86601f82edc8234d18fe8921bdc9921
Contents?: true
Size: 707 Bytes
Versions: 86
Compression:
Stored size: 707 Bytes
Contents
/** 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) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } module.exports = isIndex;
Version data entries
86 entries across 64 versions & 9 rubygems