Skip to content

Commit ba4be74

Browse files
authored
fix: lint
1 parent 8eec7fc commit ba4be74

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

index.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const SINGLE_TICK = /'/g
1414
let largeArraySize = 2e4
1515
let largeArrayMechanism = 'default'
1616

17-
function inlineAsInteger(options, input) {
17+
function inlineAsInteger (options, input) {
1818
let roundingFn = 'Math.trunc'
1919
if (options && options.rounding) {
2020
switch (options.rounding) {
@@ -47,7 +47,7 @@ function inlineAsInteger(options, input) {
4747
`
4848
}
4949

50-
function inlineAsNumber(input) {
50+
function inlineAsNumber (input) {
5151
return `
5252
// #region inlineAsNumber
5353
const num = Number(${input})
@@ -62,13 +62,13 @@ function inlineAsNumber(input) {
6262
`
6363
}
6464

65-
function inlineAsBoolean(input) {
65+
function inlineAsBoolean (input) {
6666
return `// #region inlineAsBoolean
6767
json += ${input} ? 'true' : 'false'
6868
// #endregion inlineAsBoolean`
6969
}
7070

71-
function inlineAsDateTime(input) {
71+
function inlineAsDateTime (input) {
7272
return `
7373
// #region inlineAsDateTime
7474
if (${input} === null) {
@@ -84,7 +84,7 @@ function inlineAsDateTime(input) {
8484
`
8585
}
8686

87-
function inlineAsDate(input) {
87+
function inlineAsDate (input) {
8888
return `
8989
// #region inlineAsDate
9090
if (${input} === null) {
@@ -100,7 +100,7 @@ function inlineAsDate(input) {
100100
`
101101
}
102102

103-
function inlineAsTime(input) {
103+
function inlineAsTime (input) {
104104
return `
105105
// #region inlineAsTime
106106
if (${input} === null) {
@@ -116,7 +116,7 @@ function inlineAsTime(input) {
116116
`
117117
}
118118

119-
function inlineAsString(input) {
119+
function inlineAsString (input) {
120120
return `
121121
// #region inlineAsString
122122
if (typeof ${input} !== 'string') {
@@ -138,7 +138,7 @@ function inlineAsString(input) {
138138
`
139139
}
140140

141-
function inlineAsStringInternal(input) {
141+
function inlineAsStringInternal (input) {
142142
return `
143143
// #region inlineAsStringInternal
144144
if (${input}.length === 0) {
@@ -171,7 +171,7 @@ function inlineAsStringInternal(input) {
171171
`
172172
}
173173

174-
function inlineAsUnsafeString(input) {
174+
function inlineAsUnsafeString (input) {
175175
return `// #region inlineAsUnsafeString
176176
json += JSON_STR_QUOTE + ${input} + JSON_STR_QUOTE
177177
// #endregion inlineAsUnsafeString`
@@ -191,7 +191,7 @@ const validLargeArrayMechanisms = new Set([
191191

192192
let schemaIdCounter = 0
193193

194-
function isValidSchema(schema, name) {
194+
function isValidSchema (schema, name) {
195195
if (!validate(schema)) {
196196
if (name) {
197197
name = `"${name}" `
@@ -205,7 +205,7 @@ function isValidSchema(schema, name) {
205205
}
206206
}
207207

208-
function resolveRef(context, location) {
208+
function resolveRef (context, location) {
209209
const ref = location.schema.$ref
210210

211211
let hashIndex = ref.indexOf('#')
@@ -229,27 +229,27 @@ function resolveRef(context, location) {
229229
return newLocation
230230
}
231231

232-
function getMergedLocation(context, mergedSchemaId) {
232+
function getMergedLocation (context, mergedSchemaId) {
233233
const mergedSchema = context.refResolver.getSchema(mergedSchemaId, '#')
234234
return new Location(mergedSchema, mergedSchemaId, '#')
235235
}
236236

237-
function getSchemaId(schema, rootSchemaId) {
237+
function getSchemaId (schema, rootSchemaId) {
238238
if (schema.$id && schema.$id.charAt(0) !== '#') {
239239
return schema.$id
240240
}
241241
return rootSchemaId
242242
}
243243

244-
function getSafeSchemaRef(context, location) {
244+
function getSafeSchemaRef (context, location) {
245245
let schemaRef = location.getSchemaRef() || ''
246246
if (schemaRef.startsWith(context.rootSchemaId)) {
247247
schemaRef = schemaRef.replace(context.rootSchemaId, '') || '#'
248248
}
249249
return schemaRef
250250
}
251251

252-
function build(schema, options) {
252+
function build (schema, options) {
253253
isValidSchema(schema)
254254

255255
options = options || {}
@@ -429,7 +429,7 @@ const numberKeywords = [
429429
* Infer type based on keyword in order to generate optimized code
430430
* https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6
431431
*/
432-
function inferTypeByKeyword(schema) {
432+
function inferTypeByKeyword (schema) {
433433
for (const keyword of objectKeywords) {
434434
if (keyword in schema) return 'object'
435435
}
@@ -445,7 +445,7 @@ function inferTypeByKeyword(schema) {
445445
return schema.type
446446
}
447447

448-
function buildExtraObjectPropertiesSerializer(context, location, addComma, objVar) {
448+
function buildExtraObjectPropertiesSerializer (context, location, addComma, objVar) {
449449
const schema = location.schema
450450
const propertiesKeys = Object.keys(schema.properties || {})
451451

@@ -506,7 +506,7 @@ function buildExtraObjectPropertiesSerializer(context, location, addComma, objVa
506506
return code
507507
}
508508

509-
function buildInnerObject(context, location, objVar) {
509+
function buildInnerObject (context, location, objVar) {
510510
const schema = location.schema
511511

512512
const propertiesLocation = location.getPropertyLocation('properties')
@@ -588,7 +588,7 @@ function buildInnerObject(context, location, objVar) {
588588
return code
589589
}
590590

591-
function mergeLocations(context, mergedSchemaId, mergedLocations) {
591+
function mergeLocations (context, mergedSchemaId, mergedLocations) {
592592
for (let i = 0, mergedLocationsLength = mergedLocations.length; i < mergedLocationsLength; i++) {
593593
const location = mergedLocations[i]
594594
const schema = location.schema
@@ -612,7 +612,7 @@ function mergeLocations(context, mergedSchemaId, mergedLocations) {
612612
return mergedLocation
613613
}
614614

615-
function cloneOriginSchema(context, schema, schemaId) {
615+
function cloneOriginSchema (context, schema, schemaId) {
616616
const clonedSchema = Array.isArray(schema) ? [] : {}
617617

618618
if (
@@ -651,7 +651,7 @@ function toJSON(variableName) {
651651
`
652652
}
653653

654-
function buildObject(context, location, input) {
654+
function buildObject (context, location, input) {
655655
const schema = location.schema
656656

657657
if (context.functionsNamesBySchema.has(schema)) {
@@ -704,7 +704,7 @@ function buildObject(context, location, input) {
704704
return code
705705
}
706706

707-
function buildArray(context, location, input) {
707+
function buildArray (context, location, input) {
708708
const schema = location.schema
709709

710710
let itemsLocation = location.getPropertyLocation('items')
@@ -893,7 +893,7 @@ function buildArray(context, location, input) {
893893
return inlinedCode
894894
}
895895

896-
function buildArrayTypeCondition(type, accessor) {
896+
function buildArrayTypeCondition (type, accessor) {
897897
let condition
898898
switch (type) {
899899
case 'null':
@@ -936,11 +936,11 @@ function buildArrayTypeCondition(type, accessor) {
936936
return condition
937937
}
938938

939-
function generateFuncName(context) {
939+
function generateFuncName (context) {
940940
return 'anonymous' + context.functionsCounter++
941941
}
942942

943-
function buildMultiTypeSerializer(context, location, input) {
943+
function buildMultiTypeSerializer (context, location, input) {
944944
const schema = location.schema
945945
const types = schema.type.sort(t1 => t1 === 'null' ? -1 : 1)
946946

@@ -1010,7 +1010,7 @@ function buildMultiTypeSerializer(context, location, input) {
10101010
return code
10111011
}
10121012

1013-
function buildSingleTypeSerializer(context, location, input) {
1013+
function buildSingleTypeSerializer (context, location, input) {
10141014
const schema = location.schema
10151015

10161016
switch (schema.type) {
@@ -1048,7 +1048,7 @@ function buildSingleTypeSerializer(context, location, input) {
10481048
}
10491049
}
10501050

1051-
function detectRecursiveSchemas(context, location) {
1051+
function detectRecursiveSchemas (context, location) {
10521052
const pathStack = new Set()
10531053
function traverse(location) {
10541054
const schema = location.schema
@@ -1134,7 +1134,7 @@ function detectRecursiveSchemas(context, location) {
11341134
traverse(location)
11351135
}
11361136

1137-
function buildConstSerializer(location, input) {
1137+
function buildConstSerializer (location, input) {
11381138
const schema = location.schema
11391139
const type = schema.type
11401140

@@ -1161,7 +1161,7 @@ function buildConstSerializer(location, input) {
11611161
return code
11621162
}
11631163

1164-
function buildAllOf(context, location, input) {
1164+
function buildAllOf (context, location, input) {
11651165
const schema = location.schema
11661166

11671167
let mergedSchemaId = context.mergedSchemasIds.get(schema)
@@ -1191,7 +1191,7 @@ function buildAllOf(context, location, input) {
11911191
return buildValue(context, mergedLocation, input)
11921192
}
11931193

1194-
function buildOneOf(context, location, input) {
1194+
function buildOneOf (context, location, input) {
11951195
context.validatorSchemasIds.add(location.schemaId)
11961196

11971197
const schema = location.schema
@@ -1243,7 +1243,7 @@ function buildOneOf(context, location, input) {
12431243
return code
12441244
}
12451245

1246-
function buildIfThenElse(context, location, input) {
1246+
function buildIfThenElse (context, location, input) {
12471247
context.validatorSchemasIds.add(location.schemaId)
12481248

12491249
const {
@@ -1311,7 +1311,7 @@ function buildIfThenElse(context, location, input) {
13111311
`
13121312
}
13131313

1314-
function buildValue(context, location, input) {
1314+
function buildValue (context, location, input) {
13151315
let schema = location.schema
13161316

13171317
if (typeof schema === 'boolean') {

0 commit comments

Comments
 (0)