From 4691a38d21955b644e59a116cfd07108169e3edf Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 21 Aug 2015 13:56:59 -0700 Subject: [PATCH] Add `baseKeys`. --- lodash.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lodash.js b/lodash.js index 103f7affc..c2d076906 100644 --- a/lodash.js +++ b/lodash.js @@ -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,