node-csvtojson icon indicating copy to clipboard operation
node-csvtojson copied to clipboard

String types which contain a number prefixed by zero are incorrectly detected

Open mryellow opened this issue 2 years ago • 0 comments

I'm looking at an old version but seems current code has the same issue.

parseFloat('01111') === 1111

"01111" is not a number, but is instead a string.

https://github.com/Keyang/node-csvtojson/blob/89a9a36cf1be8fb2da93359b2a4d1d6765a7adf7/src/lineToJson.ts#L162-L168

Unfortunately isFinite('01111') === true also otherwise it may be a solution.

You may need a Regex based approach.

mryellow avatar Apr 19 '23 03:04 mryellow