scurker/currency.js

Handling NaN

imtyM opened this issue · 0 comments

imtyM commented

The internal parse function extracts a valid number from the value provided for numerous cases, and defaults to 0 when it can't. Since typeof NaN is number, NaN is a valid value for a currency object.

Is this intended? And why?
For our project, it's very useful for the value to default to 0 when the value provided to currency is NaN.

I could attempt to add a check for NaN if this is not intended. :)