node-csvtojson
node-csvtojson copied to clipboard
Fix bug where closing quote was not removed
I have seen many (manually edited) csv files in the wild that are formatted to visually have commas like columns. Example:
title ,description ,number value, more text,number 2
line 1,"short, precise" ,5 , sometimes,1
line 2,"a long, long description" ,6 , even,2
line 3,"an even longer description with many words",5 ,right-aligned,3
line 4, " and crazy stuff " ,5 , columns,3
The current implementation has some errors with those lines.
This closing quote and the whitespace is not removed (only the last space to be precise):
line 1,"short, precise" ,5 , sometimes,1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This whitespace is not removed even if option trim is enabled (neither is the closing quote)
line 4, " and crazy stuff " ,5 , columns,3
^^^^^ ^^^^^
The pull requests fixes those issues