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

Configure number_separator for minimum length for either side of decimal #1200

Closed
bjarkehs opened this issue Jan 16, 2017 · 4 comments · Fixed by #1202
Closed

Configure number_separator for minimum length for either side of decimal #1200

bjarkehs opened this issue Jan 16, 2017 · 4 comments · Fixed by #1202
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@bjarkehs
Copy link
Contributor

I ran into this while working on a project using coordinates. While I would like the minimum length of 5, it should apply to either side of the decimal.

So taking the example from #1109 I find 1000.01 more readable than 1_000.01 or 10.0003 more readable than 10.000_3

Maybe even be able to ignore after the decimal.

Is this something others would be interested in as well? Because then I'd look into making a PR.

@marcelofabri marcelofabri added the enhancement Ideas for improvements of existing features and rules. label Jan 16, 2017
@marcelofabri
Copy link
Collaborator

I think that makes sense. Feel free to send a PR! 💯

@bjarkehs
Copy link
Contributor Author

I just realized while looking at the code that this is actually how it works. This is an oversight/a case of the mondays.

I have another idea, and please tell me if this is not really useful or too specific. I'm also not entirely sure on the naming/api.

But let's say I want to have a minimum length of 5 for everything before decimal, so as #1109 suggests: 10000 becomes 10_000 but 1000 stays the same. But at the same time I want my decimals to be split at a later point. So my code could look like this:

let number = 10_000
let coord = 56.00529
let coord2 = 57.045_423_2

The configuration could be something like

number_separator:
  minimum_length: 5
  minimum_fraction_length: 7

@marcelofabri
Copy link
Collaborator

That was what I thought you ment in the original issue 😅

@bjarkehs
Copy link
Contributor Author

Haha, cool. I'll do that then.

I was thinking of ways to specify it better, but any other would break current API I guess.

This should be sufficient anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants