Add baseKeys.

This commit is contained in:
John-David Dalton
2015-08-21 13:56:59 -07:00
parent 00bae752d0
commit 4691a38d21

View File

@@ -2167,6 +2167,19 @@
return property(func);
}
/**
* The base implementation of `_.keys` which doesn't skip the constructor
* property of prototypes or treat sparse arrays as dense.
*
* @private
* @type Function
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
return nativeKeys(Object(object));
}
/**
* The base implementation of `_.keysIn` which doesn't skip the constructor
* property of prototypes or treat sparse arrays as dense.
@@ -9117,11 +9130,9 @@
* // => ['0', '1']
*/
function keys(object) {
object = Object(object);
var isProto = isPrototype(object);
if (!(isProto || isArrayLike(object))) {
return nativeKeys(object);
return baseKeys(object);
}
var result = initKeys(object),
length = result.length,