File tree 1 file changed +5
-4
lines changed 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ function formatValue(value: mixed, seenValues: Array<mixed>): string {
17
17
case 'function' :
18
18
return value . name ? `[function ${ value . name } ]` : '[function]' ;
19
19
case 'object' :
20
- if ( value === null ) {
21
- return 'null' ;
22
- }
23
20
return formatObjectValue ( value , seenValues ) ;
24
21
default:
25
22
return String ( value ) ;
@@ -30,14 +27,18 @@ function formatObjectValue(
30
27
value : Object ,
31
28
previouslySeenValues : Array < mixed > ,
32
29
) : string {
30
+ if ( value === null ) {
31
+ return 'null' ;
32
+ }
33
+
33
34
if ( previouslySeenValues . indexOf ( value ) !== - 1 ) {
34
35
return '[Circular]' ;
35
36
}
36
37
37
38
const seenValues = [ ...previouslySeenValues , value ] ;
38
39
39
40
if ( typeof value . toJSON === 'function' ) {
40
- const jsonValue = value . toJSON ( value ) ;
41
+ const jsonValue = ( value . toJSON : ( ) => mixed ) ( ) ;
41
42
42
43
// check for infinite recursion
43
44
if ( jsonValue !== value ) {
You can’t perform that action at this time.
0 commit comments