Check if a number is in a given range
$ npm install in-range
import inRange from 'in-range';
inRange(30, {end: 100}); // 0..100
//=> true
inRange(30, {start: 10, end: 100}); // 10..100
//=> true
inRange(30, {start: 100, end: 10}); // 10..100
//=> true
inRange(30, {end: 10}); // 0..10
//=> false
// Any input can be a BigInt
inRange(30n, {start: 100n, end: 10}); // 10..100
//=> true
Type: number | BigInt
Number to check.
Type: object
Type: number | BigInt
Default: 0
Start of the range.
Type: number | BigInt
End of the range.