* 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)
| 10117 | * @returns {Array} Returns the array of property names. |
| 10118 | */ |
| 10119 | function arrayLikeKeys(value, inherited) { |
| 10120 | var isArr = isArray(value), |
| 10121 | isArg = !isArr && isArguments(value), |
| 10122 | isBuff = !isArr && !isArg && isBuffer(value), |
| 10123 | isType = !isArr && !isArg && !isBuff && isTypedArray(value), |
| 10124 | skipIndexes = isArr || isArg || isBuff || isType, |
| 10125 | result = skipIndexes ? baseTimes(value.length, String) : [], |
| 10126 | length = result.length; |
| 10127 | |
| 10128 | for (var key in value) { |
| 10129 | if ((inherited || hasOwnProperty.call(value, key)) && |
| 10130 | !(skipIndexes && ( |
| 10131 | // Safari 9 has enumerable `arguments.length` in strict mode. |
| 10132 | key == 'length' || |
| 10133 | // Node.js 0.10 has enumerable non-index properties on buffers. |
| 10134 | (isBuff && (key == 'offset' || key == 'parent')) || |
| 10135 | // PhantomJS 2 has enumerable non-index properties on typed arrays. |
| 10136 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || |
| 10137 | // Skip index properties. |
| 10138 | isIndex(key, length) |
| 10139 | ))) { |
| 10140 | result.push(key); |
| 10141 | } |
| 10142 | } |
| 10143 | return result; |
| 10144 | } |
| 10145 | |
| 10146 | /** |
| 10147 | * A specialized version of `_.sample` for arrays. |
no test coverage detected