mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +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)
|
* // => ['x', 'y'] (iteration order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
var keys = !nativeKeys ? shimKeys : function(object) {
|
var keys = !nativeKeys ? shimKeys : function(object) {
|
||||||
object = toObject(object);
|
if (object == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
var Ctor = object.constructor,
|
var Ctor = object.constructor,
|
||||||
length = object.length;
|
length = object.length;
|
||||||
|
|
||||||
@@ -7633,7 +7634,7 @@
|
|||||||
(support.enumPrototypes && typeof object == 'function')) {
|
(support.enumPrototypes && typeof object == 'function')) {
|
||||||
return shimKeys(object);
|
return shimKeys(object);
|
||||||
}
|
}
|
||||||
return nativeKeys(object);
|
return nativeKeys(toObject(object));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user