Skip to content

createLexicographicalComparator

createLexicographicalComparator<T>(compare): Comparator<Iterable<T, any, any>>

Defined in: packages/core/src/function/compare/create-lexicographical-comparator.ts:11

Lifts compare to sequences, comparing element by element and ordering a proper prefix before the sequence that extends it.

Consumes both operands lazily and stops at the first difference, so it costs one compare call per element only when the two share a full prefix. Both iterators are closed on the way out.

T

Comparator<T>

Comparator<Iterable<T, any, any>>