File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import {
42
42
isPlainObject ,
43
43
isMap ,
44
44
isSet ,
45
+ reviver ,
45
46
sortByKey
46
47
} from ' src/util'
47
48
@@ -95,14 +96,14 @@ export default {
95
96
isSet (value) || isMap (value)
96
97
},
97
98
formattedValue () {
98
- const value = this .field .value
99
+ const value = reviver ( this .field .value )
99
100
if (value === null ) {
100
101
return ' null'
101
- } else if (value === UNDEFINED || value === undefined ) {
102
+ } else if (value === undefined ) {
102
103
return ' undefined'
103
- } else if (value === NAN || Number .isNaN (value)) {
104
+ } else if (Number .isNaN (value)) {
104
105
return ' NaN'
105
- } else if (value === INFINITY || value === Number .POSITIVE_INFINITY ) {
106
+ } else if (value === Number .POSITIVE_INFINITY ) {
106
107
return ' Infinity'
107
108
} else if (Array .isArray (value)) {
108
109
return ' Array[' + value .length + ' ]'
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ function initApp (shell) {
81
81
} )
82
82
83
83
bridge . on ( 'instance-details' , details => {
84
- store . commit ( 'components/RECEIVE_INSTANCE_DETAILS' , parse ( details , true ) )
84
+ store . commit ( 'components/RECEIVE_INSTANCE_DETAILS' , parse ( details ) )
85
85
} )
86
86
87
87
bridge . on ( 'vuex:init' , snapshot => {
Original file line number Diff line number Diff line change @@ -70,16 +70,16 @@ export function parse (data, revive) {
70
70
: CircularJSON . parse ( data )
71
71
}
72
72
73
- function reviver ( key , val ) {
73
+ export function reviver ( key , val ) {
74
74
if ( val === UNDEFINED ) {
75
75
return undefined
76
76
} else if ( val === INFINITY ) {
77
77
return Infinity
78
78
} else if ( val === NAN ) {
79
79
return NaN
80
- } else if ( isString ( val ) && val . startsWith ( SET ) ) {
80
+ } else if ( isSerializedSet ( val ) ) {
81
81
return new Set ( parse ( val . substring ( SET . length ) , true ) )
82
- } else if ( isString ( val ) && val . startsWith ( MAP ) ) {
82
+ } else if ( isSerializedMap ( val ) ) {
83
83
return new Map ( parse ( val . substring ( MAP . length ) , true ) )
84
84
} else {
85
85
return val
@@ -121,6 +121,14 @@ export function isSet (obj) {
121
121
return obj instanceof Set
122
122
}
123
123
124
+ export function isSerializedMap ( obj ) {
125
+ return isString ( obj ) && obj . startsWith ( MAP )
126
+ }
127
+
128
+ export function isSerializedSet ( obj ) {
129
+ return isString ( obj ) && obj . startsWith ( SET )
130
+ }
131
+
124
132
export function isString ( obj ) {
125
133
return obj instanceof String || typeof obj === 'string'
126
134
}
You can’t perform that action at this time.
0 commit comments