1 var isArguments = require('../lang/isArguments'),
2 isArray = require('../lang/isArray'),
3 isIndex = require('./isIndex'),
4 isLength = require('./isLength'),
5 keysIn = require('../object/keysIn'),
6 support = require('../support');
8 /** Used for native method references. */
9 var objectProto = Object.prototype;
11 /** Used to check objects for own properties. */
12 var hasOwnProperty = objectProto.hasOwnProperty;
15 * A fallback implementation of `Object.keys` which creates an array of the
16 * own enumerable property names of `object`.
19 * @param {Object} object The object to query.
20 * @returns {Array} Returns the array of property names.
22 function shimKeys(object) {
23 var props = keysIn(object),
24 propsLength = props.length,
25 length = propsLength && object.length;
27 var allowIndexes = length && isLength(length) &&
28 (isArray(object) || (support.nonEnumArgs && isArguments(object)));
33 while (++index < propsLength) {
34 var key = props[index];
35 if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
42 module.exports = shimKeys;