Open swansontec opened 5 years ago
The number is always a three digit/character long string. So it would be cc.number('036')
. Right now I can't remember why I chose this in the first place. I can see that the documentation does not reflect this totally though.
And yeah, it would probably be nice to move this logic into the library. So that it would check if it gets an integer so that cc.number(36)
is the same a cc.number('036')
@freeall Do you still accept PRs to improve this library? I'm considering contributions, including a fix for this.
If you need help maintaining this repo and NPM package, I'm also happy to volunteer as a maintainer.
^ There's my first contribution, if you'll have it :)
If I do
number(36)
, I getundefined
, not AUD.This is because the number lookup uses string comparisons, and there is a leading zero in the currency code.
I can work around this by doing:
number(('000' + code).slice(-3))
, which inserts the leading zeros as needed. This logic should probably move into the library itself.