|
import baseTimes from './_baseTimes.js'; |
|
import isArguments from './isArguments.js'; |
|
import isArray from './isArray.js'; |
|
import isBuffer from './isBuffer.js'; |
|
import isIndex from './_isIndex.js'; |
|
import isTypedArray from './isTypedArray.js'; |
|
|
|
|
|
var objectProto = Object.prototype; |
|
|
|
|
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function arrayLikeKeys(value, inherited) { |
|
var isArr = isArray(value), |
|
isArg = !isArr && isArguments(value), |
|
isBuff = !isArr && !isArg && isBuffer(value), |
|
isType = !isArr && !isArg && !isBuff && isTypedArray(value), |
|
skipIndexes = isArr || isArg || isBuff || isType, |
|
result = skipIndexes ? baseTimes(value.length, String) : [], |
|
length = result.length; |
|
|
|
for (var key in value) { |
|
if ((inherited || hasOwnProperty.call(value, key)) && |
|
!(skipIndexes && ( |
|
|
|
key == 'length' || |
|
|
|
(isBuff && (key == 'offset' || key == 'parent')) || |
|
|
|
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || |
|
|
|
isIndex(key, length) |
|
))) { |
|
result.push(key); |
|
} |
|
} |
|
return result; |
|
} |
|
|
|
export default arrayLikeKeys; |
|
|