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

Support for a precision-based round/floor/ceil function #196

Open
rdmurphy opened this issue Jun 30, 2020 · 0 comments
Open

Support for a precision-based round/floor/ceil function #196

rdmurphy opened this issue Jun 30, 2020 · 0 comments

Comments

@rdmurphy
Copy link
Owner

rdmurphy commented Jun 30, 2020

JavaScript has built-in functions for doing rounding calculations via the Math object. But what is missing is a way to supply a precision value to control where the rounding takes place in a number.

Lodash's version makes it possible to pass in a second parameter declaring the precision. Jinja2's filters also include a round() function that accepts a precision value and a flag for which rounding logic to use. And because Jinja2 does it, so does Nunjucks. (This does mean that Nunjucks doesn't technically need this enhancement.)

And while the logic to do this isn't complicated it's maybe just annoying enough to re-find/copy in that this would be helpful.

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

1 participant