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

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

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.