MCPcopy Create free account
hub / github.com/dunky11/react-saas-template / arrayLikeKeys

Function arrayLikeKeys

src/shared/functions/toArray.js:387–406  ·  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

385 * @returns {Array} Returns the array of property names.
386 */
387function arrayLikeKeys(value, inherited) {
388 // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
389 // Safari 9 makes `arguments.length` enumerable in strict mode.
390 const result =
391 isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
392
393 const length = result.length;
394
395 const skipIndexes = !!length;
396
397 for (const key in value) {
398 if (
399 (inherited || hasOwnProperty.call(value, key)) &&
400 !(skipIndexes && (key === "length" || isIndex(key, length)))
401 ) {
402 result.push(key);
403 }
404 }
405 return result;
406}
407
408/**
409 * The base implementation of `getTag`.

Callers 1

keysFunction · 0.85

Calls 3

isArgumentsFunction · 0.85
baseTimesFunction · 0.85
isIndexFunction · 0.85

Tested by

no test coverage detected