Skip to content

Handle float inputs by coercing to nearest integer range#24

Open
scovetta wants to merge 1 commit intomicromatch:masterfrom
scovetta:scovetta/add-floats
Open

Handle float inputs by coercing to nearest integer range#24
scovetta wants to merge 1 commit intomicromatch:masterfrom
scovetta:scovetta/add-floats

Conversation

@scovetta
Copy link
Copy Markdown

Float arguments (e.g., toRegexRange(1.5, 9.5)) previously produced invalid regex output. Now floats are coerced to the tightest integer sub-range using ceil(min)/floor(max), and a RangeError is thrown when no integers exist within the given bounds (e.g., 1.2 to 1.8).

Fixes #5

Float arguments (e.g., toRegexRange(1.5, 9.5)) previously produced
invalid regex output. Now floats are coerced to the tightest
integer sub-range using ceil(min)/floor(max), and a RangeError
is thrown when no integers exist within the given bounds
(e.g., 1.2 to 1.8).
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

Successfully merging this pull request may close these issues.

Floating numbers

1 participant