@@ -405,14 +405,12 @@ function addPatternProperties (location) {
405
405
if (/${ regex . replace ( / \\ * \/ / g, '\\/' ) } /.test(keys[i])) {
406
406
`
407
407
if ( type === 'object' ) {
408
- code += buildObject ( ppLocation , '' , 'buildObjectPP' + index )
409
- code += `
408
+ code += `${ buildObject ( ppLocation , '' , 'buildObjectPP' + index ) }
410
409
${ addComma }
411
410
json += $asString(keys[i]) + ':' + buildObjectPP${ index } (obj[keys[i]])
412
411
`
413
412
} else if ( type === 'array' ) {
414
- code += buildArray ( ppLocation , '' , 'buildArrayPP' + index )
415
- code += `
413
+ code += `${ buildArray ( ppLocation , '' , 'buildArrayPP' + index ) }
416
414
${ addComma }
417
415
json += $asString(keys[i]) + ':' + buildArrayPP${ index } (obj[keys[i]])
418
416
`
@@ -483,14 +481,12 @@ function additionalProperty (location) {
483
481
var format = ap . format
484
482
var stringSerializer = getStringSerializer ( format )
485
483
if ( type === 'object' ) {
486
- code += buildObject ( apLocation , '' , 'buildObjectAP' )
487
- code += `
484
+ code += `${ buildObject ( apLocation , '' , 'buildObjectAP' ) }
488
485
${ addComma }
489
486
json += $asString(keys[i]) + ':' + buildObjectAP(obj[keys[i]])
490
487
`
491
488
} else if ( type === 'array' ) {
492
- code += buildArray ( apLocation , '' , 'buildArrayAP' )
493
- code += `
489
+ code += `${ buildArray ( apLocation , '' , 'buildArrayAP' ) }
494
490
${ addComma }
495
491
json += $asString(keys[i]) + ':' + buildArrayAP(obj[keys[i]])
496
492
`
@@ -792,8 +788,7 @@ function buildCode (location, code, laterCode, name) {
792
788
}
793
789
code += `${ JSON . stringify ( required [ i ] ) } `
794
790
}
795
- code += ']'
796
- code += `
791
+ code += `]
797
792
for (var i = 0; i < required.length; i++) {
798
793
if (obj[required[i]] === undefined) throw new Error('"' + required[i] + '" is required!')
799
794
}
@@ -932,11 +927,10 @@ function buildObject (location, code, name) {
932
927
r = buildInnerObject ( location , name )
933
928
}
934
929
935
- code += r . code
936
930
laterCode = r . laterCode
937
931
938
932
// Removes the comma if is the last element of the string (in case there are not properties)
939
- code += `
933
+ code += `${ r . code }
940
934
json += '}'
941
935
return json
942
936
}
@@ -1006,16 +1000,13 @@ function buildArray (location, code, name) {
1006
1000
}
1007
1001
${ result . code }
1008
1002
}
1003
+ json += ']'
1004
+ return json
1005
+ }
1009
1006
`
1010
1007
1011
1008
laterCode = result . laterCode
1012
1009
1013
- code += `
1014
- json += ']'
1015
- return json
1016
- }
1017
- `
1018
-
1019
1010
code += laterCode
1020
1011
1021
1012
return code
0 commit comments