mirror of
https://github.com/iptv-org/database.git
synced 2024-11-09 22:16:38 -05:00
Update validate.js
This commit is contained in:
parent
ac360ca8cf
commit
67d7b98f2f
1 changed files with 16 additions and 0 deletions
|
@ -79,6 +79,10 @@ async function main() {
|
|||
for (const [i, row] of rows.entries()) {
|
||||
fileErrors = fileErrors.concat(validateCountryLanguage(row, i))
|
||||
}
|
||||
} else if (filename === 'subdivisions') {
|
||||
for (const [i, row] of rows.entries()) {
|
||||
fileErrors = fileErrors.concat(validateSubdivisionCountry(row, i))
|
||||
}
|
||||
}
|
||||
|
||||
const schema = Joi.object(schemes[filename])
|
||||
|
@ -222,6 +226,18 @@ function validateCountryLanguage(row, i) {
|
|||
return errors
|
||||
}
|
||||
|
||||
function validateSubdivisionCountry(row, i) {
|
||||
const errors = []
|
||||
if (!db.countries[row.country]) {
|
||||
errors.push({
|
||||
line: i + 2,
|
||||
message: `"${row.code}" has the wrong country "${row.country}"`
|
||||
})
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
function handleError(message) {
|
||||
logger.error(chalk.red(`\n${message}`))
|
||||
process.exit(1)
|
||||
|
|
Loading…
Reference in a new issue