root / HServer / 00.Server / 00.Program / node_modules / lodash / keys.js
이력 | 보기 | 이력해설 | 다운로드 (884 Bytes)
1 | 39 | HKM | var arrayLikeKeys = require('./_arrayLikeKeys'), |
---|---|---|---|
2 | baseKeys = require('./_baseKeys'),
|
||
3 | isArrayLike = require('./isArrayLike');
|
||
4 | |||
5 | /**
|
||
6 | * Creates an array of the own enumerable property names of `object`.
|
||
7 | *
|
||
8 | * **Note:** Non-object values are coerced to objects. See the
|
||
9 | * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||
10 | * for more details.
|
||
11 | *
|
||
12 | * @static
|
||
13 | * @since 0.1.0
|
||
14 | * @memberOf _
|
||
15 | * @category Object
|
||
16 | * @param {Object} object The object to query.
|
||
17 | * @returns {Array} Returns the array of property names.
|
||
18 | * @example
|
||
19 | *
|
||
20 | * function Foo() {
|
||
21 | * this.a = 1;
|
||
22 | * this.b = 2;
|
||
23 | * }
|
||
24 | *
|
||
25 | * Foo.prototype.c = 3;
|
||
26 | *
|
||
27 | * _.keys(new Foo);
|
||
28 | * // => ['a', 'b'] (iteration order is not guaranteed)
|
||
29 | *
|
||
30 | * _.keys('hi');
|
||
31 | * // => ['0', '1']
|
||
32 | */
|
||
33 | function keys(object) { |
||
34 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
||
35 | } |
||
36 | |||
37 | module.exports = keys; |