openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.96k stars 530 forks source link

Skip for null input values #58

Open appetere opened 11 years ago

appetere commented 11 years ago

Could the code check for null values?

At the moment a null value is treated as a zero, which can be misleading:

// Choose which format to use for this value (pos, neg or zero):
var useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero,

I can work around this by checking for null before calling the method, but would be nice to handle it within accounting.js.

Thanks,

Steve

helgatheviking commented 9 years ago

I second this and think it could be resolved by pull #57 as we could test for number vs NaN and act accordingly.