From 120020b4dbf16d2203efda7d623a1a8308813825 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 17 Sep 2014 12:34:19 -0700 Subject: [PATCH] Avoid `toObject` in the `shimKeys` path of `_.keys`. --- lodash.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lodash.js b/lodash.js index 0a4a0b36e..f80d09a54 100644 --- a/lodash.js +++ b/lodash.js @@ -7623,8 +7623,9 @@ * // => ['x', 'y'] (iteration order is not guaranteed) */ var keys = !nativeKeys ? shimKeys : function(object) { - object = toObject(object); - + if (object == null) { + return []; + } var Ctor = object.constructor, length = object.length; @@ -7633,7 +7634,7 @@ (support.enumPrototypes && typeof object == 'function')) { return shimKeys(object); } - return nativeKeys(object); + return nativeKeys(toObject(object)); }; /**