NumberRange
The number should be within a specific interval.
Parameter table
| param | unit | required | description |
|---|---|---|---|
| key | yes | The key of the number to check if it is within a specific interval (key) | |
| min | no | The minimum value of the interval | |
| max | no | The maximum value of the interval | |
| includeMin | no | Whether the minimum value is included in the interval | |
| includeMax | no | Whether the maximum value is included in the interval |
How to setup
The rule verifies whether the number associated with the specified (key) is within a specific interval.
If the number does not meet this criterion, the rule will fail.
The interval is further defined by the following parameters:
includeMin: whether the minimum value should be inclusive or exclusive.includeMax: whether the maximum value should be inclusive or exclusive.
Note: min and max are inclusive by default.
Examples
| value | valid | includeMax | includeMin | max | min | description |
|---|---|---|---|---|---|---|
| 5 | ✅ | 10 | 0 | The number should be within the interval [0, 10] | ||
| 10 | ❌ | 0 | 10 | 0 | The number should be within the interval [0, 10[ | |
| 0 | ❌ | 0 | 10 | 0 | The number should be within the interval ]0, 10] | |
| 0 | ❌ | 0 | 0 | 10 | 0 | The number should be within the interval ]0, 10[ |
| 0 | ✅ | 1 | 10 | 0 | The number should be within the interval [0, 10] | |
| 10 | ✅ | 1 | 1 | 10 | 0 | The number should be within the interval [0, 10] |
| 5 | ✅ | 0 | 0 | 10 | 0 | The number should be within the interval [0, 10] |