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

NameTypeDescription
valuenumberNumber to compare against.
allowEqualbooleanWhen true, equality is accepted.

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.