@@ -82,12 +82,16 @@ export function sleep(milliseconds: number) {
8282
8383export function stringify ( this : any , key : string , value : any ) : any {
8484 if ( typeof value === 'function' ) {
85- return "<function>" ;
85+ if ( key === 'constructor' ) {
86+ return "<function>" ;
87+ }
88+ return ( value as Function ) . toString ( ) ;
8689 }
8790 if ( typeof value === 'symbol' ) {
8891 return "<symbol>" ;
8992 }
9093 if ( typeof value === 'undefined' ) {
94+ // return null;
9195 return "<undefined>" ;
9296 }
9397 if ( value === null ) {
@@ -100,7 +104,8 @@ export function stringify(this: any, key: string, value: any): any {
100104 return Array . from ( value . entries ( ) ) ;
101105 }
102106 if ( value instanceof RegExp ) {
103- return value . source ;
107+ return `</${ value . source } /${ value . flags } >` ;
108+ // return `/${value.source}/${value.flags}`;
104109 }
105110 if ( key . startsWith ( "HEAP" ) ) {
106111 return `<${ key } >` ;
@@ -111,6 +116,21 @@ export function stringify(this: any, key: string, value: any): any {
111116 if ( key === 'locationData' ) {
112117 return "<locationData>" ;
113118 }
119+ if ( Array . isArray ( value ) ) {
120+ return value ;
121+ }
122+ if ( typeof value === 'object' ) {
123+ // return value;
124+ const nonEnumerableObject : { [ key : string ] : any ; } = { } ;
125+ nonEnumerableObject . constructor = value . constructor . toString ( ) ;
126+
127+ // Get all property names, including non-enumerable ones
128+ Object . getOwnPropertyNames ( value ) . forEach ( key => {
129+ nonEnumerableObject [ key ] = value [ key ] ;
130+ } ) ;
131+
132+ return nonEnumerableObject ;
133+ }
114134 return value ;
115135}
116136
0 commit comments