1 var baseKeysIn = require('./_baseKeysIn'),
2 indexKeys = require('./_indexKeys'),
3 isIndex = require('./_isIndex'),
4 isPrototype = require('./_isPrototype');
6 /** Used for built-in method references. */
7 var objectProto = Object.prototype;
9 /** Used to check objects for own properties. */
10 var hasOwnProperty = objectProto.hasOwnProperty;
13 * Creates an array of the own and inherited enumerable property names of `object`.
15 * **Note:** Non-object values are coerced to objects.
20 * @param {Object} object The object to query.
21 * @returns {Array} Returns the array of property names.
29 * Foo.prototype.c = 3;
32 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
34 function keysIn(object) {
36 isProto = isPrototype(object),
37 props = baseKeysIn(object),
38 propsLength = props.length,
39 indexes = indexKeys(object),
40 skipIndexes = !!indexes,
41 result = indexes || [],
42 length = result.length;
44 while (++index < propsLength) {
45 var key = props[index];
46 if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
47 !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
54 module.exports = keysIn;