Closed marnusw closed 6 years ago
Also for me is very important to format percentages values. Just to add some more requirements: Because a percentage value can be a very small number (0.5 = 50%), or a big number (20 = 20%); i suggest to having a "multiplier" parameter in an hypothetical function like "formatPercentage( value, multiplier ){}". where default value for "multiplier" should be 1 (so itself), and in case anyone can specify its own multiplier (like usually can be 100).
Is something similar planned to be done? If you like I can contribute directly to your code.
Excellent work on creating this library!
In my application I need to format numbers as both currencies and percentages. I've written a separate utility for percentages, but I'd imagine it's something that has to be printed alongside currencies often enough that it might be included in this library? A lot of the generic formatting/unformatting work has already been done within accounting.js which should ideally be reused.
My thinking is that if you pass in a floating point fraction in the range
0..1
this will be multiplied by100
and printed with a'%'
sign, with the same kind of formatting options you have for currencies.What would your feeling be on adding percentage support? If it's something you'll consider I'll make the additions and create a pull request!