Skip to content

Commit 318cc44

Browse files
authored
chore: unnecessary stringify calls (#383)
1 parent 528f938 commit 318cc44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ function addIfThenElse (location, name) {
849849
ajvInstance.addSchema(i, schemaKey)
850850

851851
code += `
852-
valid = ajv.validate(${JSON.stringify(schemaKey)}, obj)
852+
valid = ajv.validate("${schemaKey}", obj)
853853
if (valid) {
854854
`
855855
if (merged.if && merged.then) {
@@ -1203,7 +1203,7 @@ function nested (laterCode, name, key, location, subKey, isArray) {
12031203
ajvInstance.addSchema(location.schema, schemaKey)
12041204

12051205
code += `
1206-
${index === 0 ? 'if' : 'else if'}(ajv.validate(${JSON.stringify(schemaKey)}, ${testValue}))
1206+
${index === 0 ? 'if' : 'else if'}(ajv.validate("${schemaKey}", ${testValue}))
12071207
${nestedResult.code}
12081208
`
12091209
laterCode = nestedResult.laterCode
@@ -1224,7 +1224,7 @@ function nested (laterCode, name, key, location, subKey, isArray) {
12241224
ajvInstance.addSchema(location.schema, schemaKey)
12251225

12261226
code += `
1227-
${index === 0 ? 'if' : 'else if'}(ajv.validate(${JSON.stringify(schemaKey)}, ${testValue}))
1227+
${index === 0 ? 'if' : 'else if'}(ajv.validate("${schemaKey}", ${testValue}))
12281228
${nestedResult.code}
12291229
`
12301230
laterCode = nestedResult.laterCode

0 commit comments

Comments
 (0)