lte()
lte(
value,other):boolean
Checks if value is less than or equal to other.
DEPRECATED
Use the <= operator directly instead.
Parametersβ
value: numberβ
The value to compare.
other: numberβ
The other value to compare.
Returns: booleanβ
true if value is less than or equal to other, else false.
See Alsoβ
Sinceβ
2.0.0
Also known asβ
lte (Lodash, Ramda) Β· β (es-toolkit, Remeda, Radashi, Effect, Modern Dash, Antfu)
Exampleβ
// β Deprecated approach
lte(1, 3); // => true
lte(3, 3); // => true
lte(3, 1); // => false
// β
Recommended approach
1 <= 3; // => true
3 <= 3; // => true
3 <= 1; // => false
How it works?β
Checks if value is less than or equal to other.
Deprecated: Use <= operator directly.
Native Equivalentβ
// β lte(a, b)
// β
a <= b
Use Casesβ
Compare less or equal πβ
Check if first value is less than or equal to second.
a <= b;
Validate maximumβ
Check maximum constraints.
if (quantity <= maxQuantity) {
processOrder(quantity);
}