predictype / predicates/numbers/numberComparison / numberComparison
numberComparison(
source
,oper
,target
):boolean
Defined in: predicates/numbers/numberComparison.ts:30
Compares two numbers using the specified operation.
number
The first number.
The comparison operation to perform (e.g. ‘greater_than’, ‘equals’).
number
The second number.
boolean
True if the comparison is valid according to the operator, otherwise false.
If the operation is not recognized.
const a = 5;
const b = 10;
numberComparison(a, 'less_than', b); // true
numberComparison(a, 'greater_than', b); // false
numberComparison(a, 'equals', 5); // true
Supported Operators: