mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Fix _.keysIn for inherited non-enumerable props.
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -8027,7 +8027,8 @@
|
|||||||
var keyIndex,
|
var keyIndex,
|
||||||
Ctor = object.constructor,
|
Ctor = object.constructor,
|
||||||
index = -1,
|
index = -1,
|
||||||
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
|
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto,
|
||||||
|
isProto = proto === object,
|
||||||
result = Array(length),
|
result = Array(length),
|
||||||
skipIndexes = length > 0,
|
skipIndexes = length > 0,
|
||||||
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
|
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
|
||||||
@@ -8052,13 +8053,16 @@
|
|||||||
index = -1;
|
index = -1;
|
||||||
length = shadowedProps.length;
|
length = shadowedProps.length;
|
||||||
|
|
||||||
if (isProto) {
|
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
|
||||||
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
|
nonEnum = nonEnumProps[className] || nonEnumProps[objectClass];
|
||||||
nonEnum = nonEnumProps[className];
|
|
||||||
|
if (className == objectClass) {
|
||||||
|
proto = objectProto;
|
||||||
}
|
}
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
key = shadowedProps[index];
|
key = shadowedProps[index];
|
||||||
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
|
if (!(isProto && nonEnum[key]) &&
|
||||||
|
(key == 'constructor' ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) {
|
||||||
result.push(key);
|
result.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user