Skip to content

isLowerThan

Checks whether the number is lower than another value. Set allowEqual to true when the boundary value should also pass, such as validating a maximum allowed count.

Usage

ts
const isBelowLimit = (9).isLowerThan(10);

// true

Parameters

value: number
Number to compare against.

allowEqual?: boolean
When true, equality is accepted.
Default: false

Returns

true when the number is lower than value, or lower than or equal when allowEqual is true.

Type signature

ts
interface Number {
    isLowerThan(value: number, allowEqual?: boolean): boolean;
}

All packages are released under the MIT License.