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 {
6161 return obj . toJSON ( ) ;
6262 }
6363 // Only check for circularity among ancestors in the recursion stack.
64- if ( refs . indexOf ( obj ) !== - 1 ) {
64+ if ( refs . includes ( obj ) ) {
6565 return "[Circular]" ;
6666 }
6767 // Add the current object to the recursion stack.
6868 refs . push ( obj ) ;
6969
7070 const returnObj : any = Array . isArray ( obj ) ? [ ] : { } ;
7171 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 ) ;
7573 }
74+
7675 // Remove the current object from the stack once its properties are processed.
7776 refs . pop ( ) ;
7877 return returnObj ;
You can’t perform that action at this time.
0 commit comments