MCPcopy
hub / github.com/tdewolff/minify / arrayLikeKeys

Function arrayLikeKeys

_benchmarks/sample_antd.js:78059–78084  ·  view source on GitHub ↗

* Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names.

(value, inherited)

Source from the content-addressed store, hash-verified

78057 * @returns {Array} Returns the array of property names.
78058 */
78059function arrayLikeKeys(value, inherited) {
78060 var isArr = isArray(value),
78061 isArg = !isArr && isArguments(value),
78062 isBuff = !isArr && !isArg && isBuffer(value),
78063 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
78064 skipIndexes = isArr || isArg || isBuff || isType,
78065 result = skipIndexes ? baseTimes(value.length, String) : [],
78066 length = result.length;
78067
78068 for (var key in value) {
78069 if ((inherited || hasOwnProperty.call(value, key)) &&
78070 !(skipIndexes && (
78071 // Safari 9 has enumerable `arguments.length` in strict mode.
78072 key == 'length' ||
78073 // Node.js 0.10 has enumerable non-index properties on buffers.
78074 (isBuff && (key == 'offset' || key == 'parent')) ||
78075 // PhantomJS 2 has enumerable non-index properties on typed arrays.
78076 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
78077 // Skip index properties.
78078 isIndex(key, length)
78079 ))) {
78080 result.push(key);
78081 }
78082 }
78083 return result;
78084}
78085
78086module.exports = arrayLikeKeys;
78087

Callers 1

keysFunction · 0.85

Calls 4

isTypedArrayFunction · 0.85
baseTimesFunction · 0.85
isArrayFunction · 0.70
isIndexFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…