Skip to content

isInRange ​

Checks whether the number falls inside an inclusive range. Both boundaries are included, so the method returns true when the number is exactly equal to min or max.

Usage ​

ts
const isValidPageSize = (25).isInRange(5, 100);

// true

Parameters

min: number
Inclusive lower bound.

max: number
Inclusive upper bound.

Returns

true when the number is between min and max.

Type signature ​

ts
interface Number {
    isInRange(min: number, max: number): boolean;
}

All packages are released under the MIT License.