Skip to main content

Function: greaterOrEqualThan()

greaterOrEqualThan<ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean

Determines if the elements of iterable are lexicographically greater or equal than those of another.

Type Parameters

Type Parameter
ElementType

Parameters

ParameterTypeDescription
iterableIterableResolvable<ElementType>The iterator to compare.
otherIterableResolvable<ElementType>The iterator to compare against.

Returns

boolean

Example

import { greaterOrEqualThan } from '@sapphire/iterator-utilities';

const x = [1, 2, 3, 4];
const y = [1, 4, 9, 16];
console.log(greaterOrEqualThan([1], [1]));
// Output: true
console.log(greaterOrEqualThan([1], [1, 2]));
// Output: false
console.log(greaterOrEqualThan([1, 2], [1]));
// Output: true
console.log(greaterOrEqualThan([1, 2], [1, 2]));
// Output: true

Remarks

This function consumes the entire iterator.

Defined in

projects/utilities/packages/iterator-utilities/src/lib/greaterOrEqualThan.ts:32