File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ export class Struct extends Value(
182182 }
183183
184184 toJSON ( ) {
185- let normalizedFields = Object . create ( null ) ;
185+ let normalizedFields = Object . create ( Struct . prototype ) ;
186186 for ( const [ key , value ] of this . fields ( ) ) {
187187 normalizedFields [ key ] = value ;
188188 }
Original file line number Diff line number Diff line change @@ -145,5 +145,17 @@ describe('JSON', () => {
145145 JSON . stringify ( load ( 'foo' ) )
146146 ) ;
147147 } ) ;
148+ it ( 'Struct is instanceof dom.Value inside JSON.stringify' , ( ) => {
149+ let struct : Value = load ( `$ion_1_0
150+ {
151+ foo:"bar"
152+ }` ) ! ;
153+
154+ const replacer = ( key , value ) => {
155+ assert . isTrue ( value instanceof Value )
156+ }
157+
158+ JSON . stringify ( struct , replacer , 2 ) ;
159+ } )
148160 } ) ;
149161} ) ;
You can’t perform that action at this time.
0 commit comments