UNPKG

776 BJavaScriptView Raw
1import arrayLikeKeys from './_arrayLikeKeys.js';
2import baseKeysIn from './_baseKeysIn.js';
3import isArrayLike from './isArrayLike.js';
4
5/**
6 * Creates an array of the own and inherited enumerable property names of `object`.
7 *
8 * **Note:** Non-object values are coerced to objects.
9 *
10 * @static
11 * @memberOf _
12 * @since 3.0.0
13 * @category Object
14 * @param {Object} object The object to query.
15 * @returns {Array} Returns the array of property names.
16 * @example
17 *
18 * function Foo() {
19 * this.a = 1;
20 * this.b = 2;
21 * }
22 *
23 * Foo.prototype.c = 3;
24 *
25 * _.keysIn(new Foo);
26 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
27 */
28function keysIn(object) {
29 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
30}
31
32export default keysIn;