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

No way to round to and keep decimal places #17

Closed
corbmanj opened this issue Mar 30, 2020 · 1 comment
Closed

No way to round to and keep decimal places #17

corbmanj opened this issue Mar 30, 2020 · 1 comment

Comments

@corbmanj
Copy link

I would like an option to roundTo and enforce that number of decimal places. For instance
roundTo(1.001, 2)
returns 1 rather than 1.00.
I understand that this representation would have to be a string in javascript, but that would be a nice option.

@sindresorhus
Copy link
Owner

roundTo(1.001, 2).toFixed(2)

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