Aller au contenu principal

gte()

gte(value, other): boolean

Checks if value is greater 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 greater than or equal to other, else false.


See Also

Greater than or equal (>=) - MDN


Since

2.0.0


Also known as

gte (Lodash, Ramda) · ❌ (es-toolkit, Remeda, Radashi, Effect, Modern Dash, Antfu)


Example

// ❌ Deprecated approach
gte(3, 1); // => true
gte(3, 3); // => true
gte(1, 3); // => false

// ✅ Recommended approach
3 >= 1; // => true
3 >= 3; // => true
1 >= 3; // => false

How it works?

Checks if value is greater than or equal to other. Deprecated: Use >= operator directly.

Native Equivalent

// ❌ gte(a, b)
// ✅ a >= b

Use Cases

Compare greater or equal 📌

Check if first value is greater than or equal to second.

a >= b;

Validate minimum

Check minimum requirements.

if (age >= 18) {
console.log('Adult');
}