node-csvtojson
node-csvtojson copied to clipboard
preFileLine line index is not incremented for the second line or row in CSV
Hello,
I am using the following sample code to convert CSV to JSON. while iterating csv rows, first iteration the lineIdx value coming as 1 and second-iteration also lineIdx value coming as 1. actually preFileLine line index value is not incremented for the second line in CSV. but the third line incrementing by 1 and the value is 2.
Is it an npm module issue? How can I solve this problem?
Note: I am using "csvtojson": "^1.1.9", verions
csv().fromStream(request.get('http://localhost:3000/response'))
.preFileLine((fileLineString, lineIdx) => {
if (lineIdx === 1) {
return fileLineString.replace(/ /g,'')
}
return fileLineString;
})
Same just ran into this. Good to know I was not crazy here.