1 | import baseKeysIn from './_baseKeysIn';
|
2 | import indexKeys from './_indexKeys';
|
3 | import isIndex from './_isIndex';
|
4 | import isPrototype from './_isPrototype';
|
5 |
|
6 |
|
7 | var objectProto = Object.prototype;
|
8 |
|
9 |
|
10 | var hasOwnProperty = objectProto.hasOwnProperty;
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | function keysIn(object) {
|
36 | var index = -1,
|
37 | isProto = isPrototype(object),
|
38 | props = baseKeysIn(object),
|
39 | propsLength = props.length,
|
40 | indexes = indexKeys(object),
|
41 | skipIndexes = !!indexes,
|
42 | result = indexes || [],
|
43 | length = result.length;
|
44 |
|
45 | while (++index < propsLength) {
|
46 | var key = props[index];
|
47 | if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
48 | !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
49 | result.push(key);
|
50 | }
|
51 | }
|
52 | return result;
|
53 | }
|
54 |
|
55 | export default keysIn;
|