Skip to main content

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​

Less than or equal (<=) - MDN


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);
}