Skip to content

Number min/max exclusive or closed ranges respectively? #411

@CoDEmanX

Description

@CoDEmanX

number().min(1).max(5) is equivalent to the open interval [1,5] (1, 2, 3, 4 and 5 are valid numbers, as well as floating point numbers in that range).

However, there doesn't seem to be a way to declare closed intervals?!

Suggested addition:
number().minExclusive(1).maxExclusive(5) would be the equivalent of (1,5). Valid numbers would be 2.0, 3.0, 4.0, but also 1.1 and 4.999. 1.0 and 5.0 are excluded.

This is only useful if floating point numbers are allowed of course, and not for number().integer().

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew functionality or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions