Skip to content

Commit feecd18

Browse files
authored
only pass rounding option to serializer of standalone (#593)
1 parent 710bd0d commit feecd18

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/standalone.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,18 @@ function buildStandaloneCode (options, validator, isValidatorUsed, contextFuncti
2525
buildAjvCode = fs.readFileSync(path.join(__dirname, 'validator.js')).toString()
2626
buildAjvCode = buildAjvCode.replace("'use strict'", '').replace('module.exports = SchemaValidator', '')
2727
}
28+
29+
const serializerOptions = options && options.rounding ? JSON.stringify({ options: options.rounding }) : ''
2830
return `
2931
'use strict'
30-
3132
${serializerCode.replace("'use strict'", '').replace('module.exports = ', '')}
3233
${buildAjvCode}
33-
34-
const serializer = new Serializer(${JSON.stringify(options || {})})
34+
const serializer = new Serializer(${serializerOptions})
3535
${ajvSchemasCode}
3636
3737
${contextFunctionCode.replace('return main', '')}
3838
39-
module.exports = main
40-
`
39+
module.exports = main`
4140
}
4241

4342
module.exports = buildStandaloneCode

0 commit comments

Comments
 (0)