Function: lessOrEqualThan()
lessOrEqualThan<
ElementType
>(iterable
:IterableResolvable
<ElementType
>,other
:IterableResolvable
<ElementType
>):boolean
Determines if the elements of iterable
are lexicographically less or equal than
those of another.
Type Parameters
Type Parameter |
---|
ElementType |
Parameters
Parameter | Type | Description |
---|---|---|
iterable | IterableResolvable <ElementType > | The iterator to compare. |
other | IterableResolvable <ElementType > | The iterator to compare against. |
Returns
boolean
Example
import { lessOrEqualThan } from '@sapphire/iterator-utilities';
const x = [1, 2, 3, 4];
const y = [1, 4, 9, 16];
console.log(lessOrEqualThan([1], [1]));
// Output: false
console.log(lessOrEqualThan([1], [1, 2]));
// Output: true
console.log(lessOrEqualThan([1, 2], [1]));
// Output: false
console.log(lessOrEqualThan([1, 2], [1, 2]));
// Output: true
Remarks
This function consumes the entire iterator.
Defined in
projects/utilities/packages/iterator-utilities/src/lib/lessOrEqualThan.ts:32