aichbauer/node-convert-csv-to-array

Last row is omitted if input string doesn't end in a newline

johnholbrook opened this issue · 1 comments

Example:

const { convertCSVToArray } = require('convert-csv-to-array');

const s = "1,2,3\n4,5,6";
let a = convertCSVToArray(s, {
    type: "array",
    separator: ","
});

a will be set to [[1,2,3]] instead of [[1,2,3],[4,5,6]].

Thank you for your contribution :)

The standard says: " The last record in the file may or may not have an ending line break". So this is a case that we need to handle.

I am open for any suggestions as well as contributions via PR.