1 var baseTimes = require('./_baseTimes'),
2 isArguments = require('./isArguments'),
3 isArray = require('./isArray'),
4 isBuffer = require('./isBuffer'),
5 isIndex = require('./_isIndex'),
6 isTypedArray = require('./isTypedArray');
8 /** Used for built-in method references. */
9 var objectProto = Object.prototype;
11 /** Used to check objects for own properties. */
12 var hasOwnProperty = objectProto.hasOwnProperty;
15 * Creates an array of the enumerable property names of the array-like `value`.
18 * @param {*} value The value to query.
19 * @param {boolean} inherited Specify returning inherited property names.
20 * @returns {Array} Returns the array of property names.
22 function arrayLikeKeys(value, inherited) {
23 var isArr = isArray(value),
24 isArg = !isArr && isArguments(value),
25 isBuff = !isArr && !isArg && isBuffer(value),
26 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
27 skipIndexes = isArr || isArg || isBuff || isType,
28 result = skipIndexes ? baseTimes(value.length, String) : [],
29 length = result.length;
31 for (var key in value) {
32 if ((inherited || hasOwnProperty.call(value, key)) &&
34 // Safari 9 has enumerable `arguments.length` in strict mode.
36 // Node.js 0.10 has enumerable non-index properties on buffers.
37 (isBuff && (key == 'offset' || key == 'parent')) ||
38 // PhantomJS 2 has enumerable non-index properties on typed arrays.
39 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
40 // Skip index properties.
49 module.exports = arrayLikeKeys;