js-number-abbreviate icon indicating copy to clipboard operation
js-number-abbreviate copied to clipboard

Rounding up/down should be an option, now it just do it automatically

Open Sebastp opened this issue 9 months ago • 1 comments

tried doing abbreviate(13992, 1) and it returns "14k" where it should be "13.9k"

Sebastp avatar Apr 30 '24 15:04 Sebastp

I think this is expected functionality! See some of the tests. Anything larger than 13950 gets rounded up:

> abbreviate(13949, 1)
'13.9k'
> abbreviate(13950, 1)
'14k'

Would accept a PR to disable rounding, if you're interested! Alternatively, if you want 2 decimal places you could do this:

> abbreviate(13992, 2)
'13.99k'

domharrington avatar Apr 30 '24 16:04 domharrington