Skip to content

Commit

Permalink
Revert "fix(util): exclude the __proto__ key from each/keys fun…
Browse files Browse the repository at this point in the history
…ction (#826)"

This reverts commit a810fee.
  • Loading branch information
plainheart committed Dec 10, 2024
1 parent b9156fc commit 1c79191
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export function each<I extends Dictionary<any> | any[] | readonly any[] | ArrayL
}
else {
for (let key in arr) {
if (arr.hasOwnProperty(key) && key !== protoKey) {
if (arr.hasOwnProperty(key)) {
cb.call(context, (arr as Dictionary<any>)[key], key as any, arr);
}
}
Expand Down Expand Up @@ -436,11 +436,11 @@ export function keys<T extends object>(obj: T): (KeyOfDistributive<T> & string)[
// `Object.keys` only return string rather than `number | string`.
type TKeys = KeyOfDistributive<T> & string;
if (Object.keys) {
return filter(Object.keys(obj) as TKeys[], key => key !== protoKey);
return Object.keys(obj) as TKeys[];
}
let keyList: TKeys[] = [];
for (let key in obj) {
if (obj.hasOwnProperty(key) && key !== protoKey) {
if (obj.hasOwnProperty(key)) {
keyList.push(key as any);
}
}
Expand Down

0 comments on commit 1c79191

Please sign in to comment.