Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
884 bytes
|
Line | |
---|
1 | 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.