1 var baseHas = require('./_baseHas'),
2 baseKeys = require('./_baseKeys'),
3 indexKeys = require('./_indexKeys'),
4 isArrayLike = require('./isArrayLike'),
5 isIndex = require('./_isIndex'),
6 isPrototype = require('./_isPrototype');
9 * Creates an array of the own enumerable property names of `object`.
11 * **Note:** Non-object values are coerced to objects. See the
12 * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
18 * @param {Object} object The object to query.
19 * @returns {Array} Returns the array of property names.
27 * Foo.prototype.c = 3;
30 * // => ['a', 'b'] (iteration order is not guaranteed)
35 function keys(object) {
36 var isProto = isPrototype(object);
37 if (!(isProto || isArrayLike(object))) {
38 return baseKeys(object);
40 var indexes = indexKeys(object),
41 skipIndexes = !!indexes,
42 result = indexes || [],
43 length = result.length;
45 for (var key in object) {
46 if (baseHas(object, key) &&
47 !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
48 !(isProto && key == 'constructor')) {
55 module.exports = keys;