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) {
326
326
}
327
327
328
328
const sanitized = JSON . stringify ( key )
329
- const asString = JSON . stringify ( sanitized )
330
329
331
330
// Using obj['key'] !== undefined instead of obj.hasOwnProperty(prop) for perf reasons,
332
331
// see https://github.com/mcollina/fast-json-stringify/pull/3 for discussion.
333
332
334
333
code += `
335
334
if (obj[${ sanitized } ] !== undefined) {
336
335
${ addComma }
337
- json += ${ asString } + ':'
336
+ json += ${ JSON . stringify ( sanitized + ':' ) }
338
337
`
339
338
340
339
code += buildValue ( propertyLocation , `obj[${ sanitized } ]` )
@@ -344,7 +343,7 @@ function buildInnerObject (location) {
344
343
code += `
345
344
} else {
346
345
${ addComma }
347
- json += ${ asString } + ':' + ${ JSON . stringify ( JSON . stringify ( defaultValue ) ) }
346
+ json += ${ JSON . stringify ( sanitized + ':' + JSON . stringify ( defaultValue ) ) }
348
347
`
349
348
} else if ( required . includes ( key ) ) {
350
349
code += `
@@ -526,15 +525,14 @@ function buildObject (location) {
526
525
`
527
526
528
527
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
532
531
`
533
532
534
533
functionCode += buildInnerObject ( location )
535
534
functionCode += `
536
- json += '}'
537
- return json
535
+ return json + '}'
538
536
}
539
537
`
540
538
You can’t perform that action at this time.
0 commit comments