inRange
Verifies number within range, inclusive start, exclusive end, flexible order, defaulting to 0 if end unspecified
185 bytes
Basic usage
Pass the number, the start and the end (optional) of the range. The _.inRange
function will return true if the given number is in the range.
- The start is inclusive, the end is exclusive. So 10 is in the range 0-11 and 10-20, but not 0-10.
- If an end is unspecified, the range defaults to
>= 0 and < start
. - If the end is lower than the start, the range is reversed.