mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Avoid toObject in the shimKeys path of _.keys.
This commit is contained in:
@@ -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));
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user