forked from BenjaminVanRyseghem/numbro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix BenjaminVanRyseghem#190 Allow abbreviation precision for < 4
Currently for some reason when using abbreviations like `'0,0a` you can't specify the number of visible digits of precision for any value less than 4. So while `'4,0a'` will change `1234567` to `1,234k` the result of `'3,0a'` is `1m` instead of `1.23m` as expected. This is primarily caused by a conditional that skips setting the precision in the formatting. This commit changes how the algorithm determines if decimal places will be required and how many are required. We first compute the abbreviated unitized value and then use the length of that value to determine how many decimal places will be required.
- Loading branch information
1 parent
e856c2b
commit c4a6204
Showing
2 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters