* 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 na
(value, inherited)
| 13006 | * @returns {Array} Returns the array of property names. |
| 13007 | */ |
| 13008 | function arrayLikeKeys(value, inherited) { |
| 13009 | var isArr = isArray(value), |
| 13010 | isArg = !isArr && isArguments(value), |
| 13011 | isBuff = !isArr && !isArg && isBuffer(value), |
| 13012 | isType = !isArr && !isArg && !isBuff && isTypedArray(value), |
| 13013 | skipIndexes = isArr || isArg || isBuff || isType, |
| 13014 | result = skipIndexes ? baseTimes(value.length, String) : [], |
| 13015 | length = result.length; |
| 13016 | |
| 13017 | for (var key in value) { |
| 13018 | if ((inherited || hasOwnProperty.call(value, key)) && |
| 13019 | !(skipIndexes && ( |
| 13020 | // Safari 9 has enumerable `arguments.length` in strict mode. |
| 13021 | key == 'length' || |
| 13022 | // Node.js 0.10 has enumerable non-index properties on buffers. |
| 13023 | (isBuff && (key == 'offset' || key == 'parent')) || |
| 13024 | // PhantomJS 2 has enumerable non-index properties on typed arrays. |
| 13025 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || |
| 13026 | // Skip index properties. |
| 13027 | isIndex(key, length) |
| 13028 | ))) { |
| 13029 | result.push(key); |
| 13030 | } |
| 13031 | } |
| 13032 | return result; |
| 13033 | } |
| 13034 | |
| 13035 | /** |
| 13036 | * A specialized version of `_.sample` for arrays. |
no test coverage detected