Skip to content

Commit 587b8f3

Browse files
jaketlarsonkamilogorek
authored andcommitted
ref: Update decycle to not include non-enumerable properties
1 parent b00159f commit 587b8f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/utils/src/object.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ export function decycle(obj: any, memo: Memo = new Memo()): any {
335335
}
336336
// tslint:disable-next-line
337337
for (const key in obj) {
338+
// Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.
339+
if (!obj.hasOwnProperty(key)) {
340+
continue;
341+
}
338342
// tslint:disable-next-line
339343
copy[key] = decycle(obj[key], memo);
340344
}

0 commit comments

Comments
 (0)