mirror of
https://github.com/iptv-org/database.git
synced 2024-11-21 18:42:31 -05:00
Update validate.js
This commit is contained in:
parent
2b7dd1a609
commit
e5d12f9f3f
1 changed files with 22 additions and 0 deletions
|
@ -147,6 +147,28 @@ function findDuplicatesById(rows) {
|
||||||
return errors
|
return errors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function findDuplicatesByName(rows) {
|
||||||
|
// rows = rows.map(row => {
|
||||||
|
// row.name = row.name.toLowerCase()
|
||||||
|
|
||||||
|
// return row
|
||||||
|
// })
|
||||||
|
|
||||||
|
// const errors = []
|
||||||
|
// const schema = Joi.array().unique((a, b) => a.name === b.name)
|
||||||
|
// const { error } = schema.validate(rows, { abortEarly: false })
|
||||||
|
// if (error) {
|
||||||
|
// error.details.forEach(detail => {
|
||||||
|
// errors.push({
|
||||||
|
// line: detail.context.pos + 2,
|
||||||
|
// message: `entry with the name "${detail.context.value.name}" already exists`
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return errors
|
||||||
|
// }
|
||||||
|
|
||||||
function validateChannelCategories(row, i) {
|
function validateChannelCategories(row, i) {
|
||||||
const errors = []
|
const errors = []
|
||||||
row.categories.forEach(category => {
|
row.categories.forEach(category => {
|
||||||
|
|
Loading…
Reference in a new issue