mirror of
https://github.com/iptv-org/database.git
synced 2024-11-23 19:34:09 -05:00
Update validate.ts
This commit is contained in:
parent
92bcf50d70
commit
2d9b6e430b
1 changed files with 1 additions and 2 deletions
|
@ -23,12 +23,11 @@ async function main() {
|
||||||
if (file.extension() !== 'csv') continue
|
if (file.extension() !== 'csv') continue
|
||||||
|
|
||||||
const csv = await dataStorage.load(file.basename())
|
const csv = await dataStorage.load(file.basename())
|
||||||
if (/\s+$/.test(csv))
|
|
||||||
return handleError(`Error: empty lines at the end of file not allowed (${filepath})`)
|
|
||||||
|
|
||||||
const rows = csv.split(/\r\n/)
|
const rows = csv.split(/\r\n/)
|
||||||
const headers = rows[0].split(',')
|
const headers = rows[0].split(',')
|
||||||
for (const [i, line] of rows.entries()) {
|
for (const [i, line] of rows.entries()) {
|
||||||
|
if (!line.trim()) continue
|
||||||
if (line.indexOf('\n') > -1)
|
if (line.indexOf('\n') > -1)
|
||||||
return handleError(
|
return handleError(
|
||||||
`Error: row ${i + 1} has the wrong line ending character, should be CRLF (${filepath})`
|
`Error: row ${i + 1} has the wrong line ending character, should be CRLF (${filepath})`
|
||||||
|
|
Loading…
Reference in a new issue