source: imaps-frontend/node_modules/lodash-es/_arrayLikeKeys.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.7 KB
Line 
1import baseTimes from './_baseTimes.js';
2import isArguments from './isArguments.js';
3import isArray from './isArray.js';
4import isBuffer from './isBuffer.js';
5import isIndex from './_isIndex.js';
6import isTypedArray from './isTypedArray.js';
7
8/** Used for built-in method references. */
9var objectProto = Object.prototype;
10
11/** Used to check objects for own properties. */
12var hasOwnProperty = objectProto.hasOwnProperty;
13
14/**
15 * Creates an array of the enumerable property names of the array-like `value`.
16 *
17 * @private
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.
21 */
22function 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;
30
31 for (var key in value) {
32 if ((inherited || hasOwnProperty.call(value, key)) &&
33 !(skipIndexes && (
34 // Safari 9 has enumerable `arguments.length` in strict mode.
35 key == 'length' ||
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.
41 isIndex(key, length)
42 ))) {
43 result.push(key);
44 }
45 }
46 return result;
47}
48
49export default arrayLikeKeys;
Note: See TracBrowser for help on using the repository browser.