inRange es-toolkit
Checks if a value is within a specified range.
Usage
inRange(value, maximum)
Use inRange when you want to check if a value is within the range from 0 to less than the maximum value. The minimum value is automatically set to 0.
Parameters
The value to check.
The maximum value of the range (exclusive).
Returns
Returns true if the value is within the range from 0 (inclusive) to the maximum value (exclusive), otherwise false.
inRange(value, minimum, maximum)
Use inRange when you want to check if a value is within a specified minimum and maximum range.
Parameters
The value to check.
The minimum value of the range (inclusive).
The maximum value of the range (exclusive).
Returns
Returns true if the value is within the specified range, otherwise false.
Throws
Throws an error if the minimum is greater than or equal to the maximum.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.