File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -326,15 +326,14 @@ function buildInnerObject (location) {
326326 }
327327
328328 const sanitized = JSON . stringify ( key )
329- const asString = JSON . stringify ( sanitized )
330329
331330 // Using obj['key'] !== undefined instead of obj.hasOwnProperty(prop) for perf reasons,
332331 // see https://github.com/mcollina/fast-json-stringify/pull/3 for discussion.
333332
334333 code += `
335334 if (obj[${ sanitized } ] !== undefined) {
336335 ${ addComma }
337- json += ${ asString } + ':'
336+ json += ${ JSON . stringify ( sanitized + ':' ) }
338337 `
339338
340339 code += buildValue ( propertyLocation , `obj[${ sanitized } ]` )
@@ -344,7 +343,7 @@ function buildInnerObject (location) {
344343 code += `
345344 } else {
346345 ${ addComma }
347- json += ${ asString } + ':' + ${ JSON . stringify ( JSON . stringify ( defaultValue ) ) }
346+ json += ${ JSON . stringify ( sanitized + ':' + JSON . stringify ( defaultValue ) ) }
348347 `
349348 } else if ( required . includes ( key ) ) {
350349 code += `
@@ -526,15 +525,14 @@ function buildObject (location) {
526525 `
527526
528527 functionCode += `
529- var obj = ${ toJSON ( 'input' ) }
530- var json = '{'
531- var addComma = false
528+ const obj = ${ toJSON ( 'input' ) }
529+ let json = '{'
530+ let addComma = false
532531 `
533532
534533 functionCode += buildInnerObject ( location )
535534 functionCode += `
536- json += '}'
537- return json
535+ return json + '}'
538536 }
539537 `
540538
You can’t perform that action at this time.
0 commit comments