keysIn.js (778B)
1 var arrayLikeKeys = require('./_arrayLikeKeys'), 2 baseKeysIn = require('./_baseKeysIn'), 3 isArrayLike = require('./isArrayLike'); 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 */ 28 function keysIn(object) { 29 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 30 } 31 32 module.exports = keysIn;