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

Option to force sub-whole digits for whole inputs #81

Open
mcandre opened this issue Aug 2, 2019 · 1 comment
Open

Option to force sub-whole digits for whole inputs #81

mcandre opened this issue Aug 2, 2019 · 1 comment

Comments

@mcandre
Copy link

mcandre commented Aug 2, 2019

Hi,

I am using go-humanize for some backend code and BenjaminVanRyseghem/numbro for frontend code. Unfortunately, these libraries have slightly different semantics when humanizing numbers, resulting in different reports depending on where data is processed.

For example, go-humanize always omits sub-whole digits when applying SIWithDigits(input, 1, units), while numbro(input).format('0.0a') always keeps sub-hole digits.

BenjaminVanRyseghem/numbro#434

I have asked numbro to make trailing .0 optional in the output. That would at least match how go-humanize behaves.

Meanwhile, it would also be helpful for go-humanize to provide an option to keep sub-hole digits in SI text, as another way to get these libraries working in sync.

@dustin
Copy link
Owner

dustin commented Aug 4, 2019

How would such an option be expressed?

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

No branches or pull requests

2 participants