Function: lessThan()
lessThan<
ElementType
>(iterable
:IterableResolvable
<ElementType
>,other
:IterableResolvable
<ElementType
>):boolean
Determines if the elements of iterable
are lexicographically less 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 { lessThan } from '@sapphire/iterator-utilities';
const x = [1, 2, 3, 4];
const y = [1, 4, 9, 16];
console.log(lessThan([1], [1]));
// Output: false
console.log(lessThan([1], [1, 2]));
// Output: true
console.log(lessThan([1, 2], [1]));
// Output: false
console.log(lessThan([1, 2], [1, 2]));
// Output: false
Remarks
This function consumes the entire iterator.
Defined in
projects/utilities/packages/iterator-utilities/src/lib/lessThan.ts:32