Skip to main content

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