Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.88k stars 604 forks source link

parseNumbers returns NaN on empty strings. #700

Open 6farer opened 8 months ago

6farer commented 8 months ago

When use the preprocessor parseNumbers, it returns NaN for empty string values. Is this expected? I would prefer to leave the value as is (I'm parsing a large object).

isNaN('') === false however parseInt('') === NaN

If this is everyone's desired behaviour, please ignore my issue. If this isn't what people are expecting, I can submit a PR. I will see if there are any comments on this issue. In the meantime I will use my own preprocessor.

Jzeemo commented 6 months ago

I am having the same issue. I expected that it should return as an empty string.

ovstetun commented 4 months ago

I would expect to have an empty string in this case - will also use my own processor for now.