File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -61,18 +61,17 @@ function removeCircular(obj: any, refs: any[] = []): any {
61
61
return obj . toJSON ( ) ;
62
62
}
63
63
// Only check for circularity among ancestors in the recursion stack.
64
- if ( refs . indexOf ( obj ) !== - 1 ) {
64
+ if ( refs . includes ( obj ) ) {
65
65
return "[Circular]" ;
66
66
}
67
67
// Add the current object to the recursion stack.
68
68
refs . push ( obj ) ;
69
69
70
70
const returnObj : any = Array . isArray ( obj ) ? [ ] : { } ;
71
71
for ( const key in obj ) {
72
- if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) {
73
- returnObj [ key ] = removeCircular ( obj [ key ] , refs ) ;
74
- }
72
+ returnObj [ key ] = removeCircular ( obj [ key ] , refs ) ;
75
73
}
74
+
76
75
// Remove the current object from the stack once its properties are processed.
77
76
refs . pop ( ) ;
78
77
return returnObj ;
You can’t perform that action at this time.
0 commit comments