Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c79191

Browse files
committed
Revert "fix(util): exclude the __proto__ key from each/keys function (#826)"
This reverts commit a810fee.
1 parent b9156fc commit 1c79191

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/core/util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export function each<I extends Dictionary<any> | any[] | readonly any[] | ArrayL
319319
}
320320
else {
321321
for (let key in arr) {
322-
if (arr.hasOwnProperty(key) && key !== protoKey) {
322+
if (arr.hasOwnProperty(key)) {
323323
cb.call(context, (arr as Dictionary<any>)[key], key as any, arr);
324324
}
325325
}
@@ -436,11 +436,11 @@ export function keys<T extends object>(obj: T): (KeyOfDistributive<T> & string)[
436436
// `Object.keys` only return string rather than `number | string`.
437437
type TKeys = KeyOfDistributive<T> & string;
438438
if (Object.keys) {
439-
return filter(Object.keys(obj) as TKeys[], key => key !== protoKey);
439+
return Object.keys(obj) as TKeys[];
440440
}
441441
let keyList: TKeys[] = [];
442442
for (let key in obj) {
443-
if (obj.hasOwnProperty(key) && key !== protoKey) {
443+
if (obj.hasOwnProperty(key)) {
444444
keyList.push(key as any);
445445
}
446446
}

0 commit comments

Comments
 (0)