mirror of
https://github.com/iptv-org/database.git
synced 2024-11-24 11:51:25 -05:00
Update validate.js
This commit is contained in:
parent
9df7946580
commit
d3a06b848d
1 changed files with 7 additions and 0 deletions
|
@ -34,6 +34,13 @@ async function main() {
|
|||
if (/\s+$/.test(csvString))
|
||||
return handleError(`Error: empty lines at the end of file not allowed (${filepath})`)
|
||||
|
||||
const rows = csvString.split('\r\n')
|
||||
const headers = rows[0].split(',')
|
||||
for (let [i, line] of rows.entries()) {
|
||||
if (line.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/).length !== headers.length)
|
||||
return handleError(`Error: row ${i + 1} has the wrong number of columns (${filepath})`)
|
||||
}
|
||||
|
||||
const filename = file.getFilename(filepath)
|
||||
let data = await csv
|
||||
.fromString(csvString)
|
||||
|
|
Loading…
Reference in a new issue