Skip to content

isGreaterThan

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

Usage

ts
const isAboveMinimum = (10).isGreaterThan(5);

// true

Parameters

value: number
Number to compare against.

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

Returns

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

Type signature

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

All packages are released under the MIT License.