Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot lookup AUD by number #20

Open
swansontec opened this issue Jan 23, 2019 · 4 comments · May be fixed by #34
Open

Cannot lookup AUD by number #20

swansontec opened this issue Jan 23, 2019 · 4 comments · May be fixed by #34

Comments

@swansontec
Copy link

If I do number(36), I get undefined, 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.

@freeall
Copy link
Owner

freeall commented Apr 11, 2019

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.

@freeall
Copy link
Owner

freeall commented Apr 11, 2019

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')

@ronkorving
Copy link

ronkorving commented Apr 1, 2021

@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.

ronkorving pushed a commit to ronkorving/currency-codes that referenced this issue Apr 1, 2021
@ronkorving ronkorving linked a pull request Apr 1, 2021 that will close this issue
ronkorving pushed a commit to ronkorving/currency-codes that referenced this issue Apr 1, 2021
@ronkorving
Copy link

^ There's my first contribution, if you'll have it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants