1 | import baseTimes from './_baseTimes.js';
|
2 | import isArguments from './isArguments.js';
|
3 | import isArray from './isArray.js';
|
4 | import isBuffer from './isBuffer.js';
|
5 | import isIndex from './_isIndex.js';
|
6 | import isTypedArray from './isTypedArray.js';
|
7 |
|
8 |
|
9 | var objectProto = Object.prototype;
|
10 |
|
11 |
|
12 | var hasOwnProperty = objectProto.hasOwnProperty;
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | function 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 |
|
35 | key == 'length' ||
|
36 |
|
37 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
38 |
|
39 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
40 |
|
41 | isIndex(key, length)
|
42 | ))) {
|
43 | result.push(key);
|
44 | }
|
45 | }
|
46 | return result;
|
47 | }
|
48 |
|
49 | export default arrayLikeKeys;
|