The number to evaluate.
Conditions to apply:
'>10'
, '<=50'
or '!=0'
.'>10'
, '<=50'
].ne
: not equal toeq
: equal tolt
: less thanlte
: less than or equal togt
: greater thangte
: greater than or equal toin
: value must be included in the provided arraybetween
: value must be between two numberstrue
if all conditions in params
evaluate to true for the given value
; otherwise, false
.
console.log(PUtilsNumber.compare(45, '>10')) // true
console.log(PUtilsNumber.compare(45, '>50')) // false
console.log(PUtilsNumber.compare(45, ['>10', '<50'])) // true
console.log(PUtilsNumber.compare(45, '!10')) // true
console.log(PUtilsNumber.compare(45, '=45')) // true
console.log(PUtilsNumber.compare(45, { gt: 10, lte: 50 })) // true
console.log(PUtilsNumber.compare(45, { in: [30, 40, 45, 50] })) // true
Compares a number against one or more conditional expressions.