Commit b1d5bdd6 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Use "for (const" instead of "for (let".

parent 402119a2
......@@ -233,7 +233,7 @@ function validateAccessActeurQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -263,7 +263,7 @@ function validateListActeursQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -170,7 +170,7 @@ function validateAccessAmendementQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -200,7 +200,7 @@ function validateListAmendementsQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -317,7 +317,7 @@ function validateAccessDocumentQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -347,7 +347,7 @@ function validateAccessContenuTexteLoiBody(body: any): [any, any] {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [body, Object.keys(errors).length === 0 ? null : errors]
......@@ -377,7 +377,7 @@ function validateListDocumentsQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -407,7 +407,7 @@ function validateListTexteLoiAmendementsQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -204,7 +204,7 @@ function validateAccessDossierQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -290,7 +290,7 @@ function validateListDossiersQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -170,7 +170,7 @@ function validateAccessOrganeQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -200,7 +200,7 @@ function validateListOrganesQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -228,7 +228,7 @@ function validateAccessReunionQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -296,7 +296,7 @@ function validateListReunionsQuery(data: any) {
errors.acteur = errors.organe = 'Either "acteur" or "organe" is required'
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -170,7 +170,7 @@ function validateAccessScrutinQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -200,7 +200,7 @@ function validateListScrutinsQuery(data: any) {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected entry"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
......@@ -29,7 +29,7 @@ export function validateArray(itemValidator: Validator): Validator {
const errors: { [key: string]: any } = {}
array = [...array]
for (let [index, value] of array.entries()) {
for (const [index, value] of array.entries()) {
const [validatedValue, error] = itemValidator(value)
array[index] = validatedValue
if (error !== null) {
......@@ -53,7 +53,7 @@ export function validateBoolean(value: any): [any, any] {
export function validateChain(...validators: Validator[]) {
return function(value: any): [any, any] {
let error = null
for (let validator of validators) {
for (const validator of validators) {
;[value, error] = validator(value)
if (error !== null) {
return [value, error]
......@@ -180,7 +180,7 @@ export function validateOption(
const errors = []
let error = null
const initialValue = value
for (let branch of branches) {
for (const branch of branches) {
value = initialValue
const validators = Array.isArray(branch) ? branch : [branch]
{
......@@ -190,7 +190,7 @@ export function validateOption(
errors.push(error)
continue
}
for (let validator of validators.slice(1)) {
for (const validator of validators.slice(1)) {
;[value, error] = validator(value)
if (error !== null) {
return [value, error]
......
......@@ -25,7 +25,7 @@ function validateDb(data: any): [any, any] {
const errors: { [key: string]: any } = {}
const remainingKeys = new Set(Object.keys(data))
for (let key of ["database", "host", "password", "user"]) {
for (const key of ["database", "host", "password", "user"]) {
remainingKeys.delete(key)
const [value, error] = validateNonEmptyTrimmedString(data[key])
data[key] = value
......@@ -51,7 +51,7 @@ function validateDb(data: any): [any, any] {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected item"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -102,7 +102,7 @@ function validateListen(data: any): [any, any] {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected item"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......@@ -170,7 +170,7 @@ export function validateServerConfig(data: any): [any, any] {
}
}
for (let key of ["dataDir", "sessionSecret"]) {
for (const key of ["dataDir", "sessionSecret"]) {
remainingKeys.delete(key)
const [value, error] = validateNonEmptyTrimmedString(data[key])
data[key] = value
......@@ -179,7 +179,7 @@ export function validateServerConfig(data: any): [any, any] {
}
}
for (let key of remainingKeys) {
for (const key of remainingKeys) {
errors[key] = "Unexpected item"
}
return [data, Object.keys(errors).length === 0 ? null : errors]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment