Creates a Comparator that compares the elements of two Iterables pairwise.
Finds the first unequal pair and returns the result
If all pairs are equal, the number of elements of the Iterables will be used for the comparison result.
Compare Iterables of numbers
const numberIterableComparator = iterableComparator(numberComparator);const result = numberIterableComparator([1, 2], [1, 1]);console.log(result); // 1
Compare Iterables with different lengths
const numberIterableComparator = iterableComparator(numberComparator);const result = numberIterableComparator([1, 1], [2]);console.log(result); // 1
a Comparator for Iterables of type T
T
the Iterable value type
the Comparator to use for the comparison of the elements
Generated using TypeDoc
Creates a Comparator that compares the elements of two Iterables pairwise.
Finds the first unequal pair and returns the result
If all pairs are equal, the number of elements of the Iterables will be used for the comparison result.
Example
Compare Iterables of numbers
Example
Compare Iterables with different lengths
Returns
a Comparator for Iterables of type
T