File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,20 @@ function customDocumentInspect(
2222 return inspect ( copyToInspect , newInspectOptions ) ;
2323}
2424
25+ function addInspectSymbol ( obj : any ) {
26+ if ( ! ( obj as any ) [ customInspectSymbol ] ) {
27+ Object . defineProperty ( obj , customInspectSymbol , {
28+ value : customDocumentInspect ,
29+ enumerable : false ,
30+ writable : true ,
31+ configurable : true ,
32+ } ) ;
33+ }
34+ }
35+
2536export function addCustomInspect ( obj : any ) {
2637 if ( Array . isArray ( obj ) ) {
27- ( obj as any ) [ customInspectSymbol ] ??= customDocumentInspect ;
38+ addInspectSymbol ( obj ) ;
2839 for ( const item of obj ) {
2940 addCustomInspect ( item ) ;
3041 }
@@ -36,7 +47,7 @@ export function addCustomInspect(obj: any) {
3647 ! ( obj instanceof Date ) &&
3748 ! ( obj instanceof RegExp )
3849 ) {
39- obj [ customInspectSymbol ] = customDocumentInspect ;
50+ addInspectSymbol ( obj ) ;
4051 for ( const value of Object . values ( obj ) ) {
4152 addCustomInspect ( value ) ;
4253 }
You can’t perform that action at this time.
0 commit comments