MCPcopy Create free account
hub / github.com/RubyLouvre/anu / arrayLikeKeys

Function arrayLikeKeys

test/babel.js:27840–27863  ·  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

27838 * @returns {Array} Returns the array of property names.
27839 */
27840 function arrayLikeKeys(value, inherited) {
27841 var isArr = isArray(value),
27842 isArg = !isArr && isArguments(value),
27843 isBuff = !isArr && !isArg && isBuffer(value),
27844 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
27845 skipIndexes = isArr || isArg || isBuff || isType,
27846 result = skipIndexes ? baseTimes(value.length, String) : [],
27847 length = result.length;
27848
27849 for (var key in value) {
27850 if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (
27851 // Safari 9 has enumerable `arguments.length` in strict mode.
27852 key == 'length' ||
27853 // Node.js 0.10 has enumerable non-index properties on buffers.
27854 isBuff && (key == 'offset' || key == 'parent') ||
27855 // PhantomJS 2 has enumerable non-index properties on typed arrays.
27856 isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
27857 // Skip index properties.
27858 isIndex(key, length)))) {
27859 result.push(key);
27860 }
27861 }
27862 return result;
27863 }
27864
27865 module.exports = arrayLikeKeys;
27866

Callers 2

keysFunction · 0.85
keysInFunction · 0.85

Calls 5

isArrayFunction · 0.85
isArgumentsFunction · 0.85
isBufferFunction · 0.85
baseTimesFunction · 0.85
isIndexFunction · 0.85

Tested by

no test coverage detected