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

parseNumbers returns NaN on empty strings.

Open 6farer opened this issue 1 year ago • 2 comments

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.

6farer avatar Feb 01 '24 19:02 6farer

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

Jzeemo avatar Mar 20 '24 09:03 Jzeemo

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

ovstetun avatar May 31 '24 06:05 ovstetun