This repository was archived by the owner on Jun 28, 2021. It is now read-only.
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
skip_empty_lines property is not working as expected #308
Open
Description
skip_empty_lines : Don't generate records for empty lines (line matching /\s*/), defaults to false.
As per the above definition it should ignore a row if it contains any string matching the regex '/\s*/'.
But when a row contains a space or tab in it, its not skipping the row and I am encountering following error
CsvError: Invalid Record Length: expect 2, got 1 on line 2
As a work around I have set trim as true and then it works.
Am I doing something wrong here or is it an issue?
const parse = require('csv-parse')
const assert = require('assert')
parse(`
"key_1","key_2"\n\t\n"value 1","value 2"
`.trim(), {
// trim: true,
columns: false,
skip_empty_lines: true
}, (err, records) => {
if (err) {
console.log('******', err)
}
assert.deepStrictEqual(
records, [
[
'key_1',
'key_2'
],
[
'value 1',
'value 2'
]]
)
})
Metadata
Metadata
Assignees
Labels
No labels