Dynamic Typing in PapaParse config breaks the module
nholmes3 opened this issue · 1 comments
nholmes3 commented
Hello,
I noticed an issue with this package where if you pass parserConfig: { dynamicTyping: true }
in the config
the code breaks if there are types other than strings in the CSV file (in my case there are numbers).
The module tries to call _clearValue
which fails because the replace function does not exist on numbers.
The use case is that I want to be able to validate that values in certain columns are in fact numbers. The workaround for now would be to add a validation function to see if the string is numeric:
function isNumeric(value: any) {
return !isNaN(parseFloat(value)) && isFinite(value);
}
However, it would be much preferred if we could rely on papaparse to perform the dynamicTyping correctly. Let me know if I can help resolve this. Thanks!