currency.js icon indicating copy to clipboard operation
currency.js copied to clipboard

#293 Format precision

Open overthemike opened this issue 4 years ago • 1 comments

This PR might need some heavy critiquing. It works by creating a new instance of currency if a precision option is passed into the format function. This will overwrite the precision value from the instantiation, however. Feel free to outright reject it and maybe suggest a better way to do it and I'd be happy to do that instead. It works though. New tests are written and all the old ones pass.

#293

overthemike avatar May 04 '21 16:05 overthemike

Nice work, see what you mean about using an entire new object. I'm interested in this type of functionality as well, our use case is around tipping calculations (multiple tips being split between multiple people, early rounding leads to annoying variances), so I generally work with precision at 4 until display output, which I want to be in standard $x.yy kind of formatting.

shaunhurley avatar Jun 11 '21 19:06 shaunhurley