Skip to main content

Function: defaultCompare()

defaultCompare<ElementType>(x: ElementType, y: ElementType): LexicographicComparison

Defined in: projects/utilities/packages/iterator-utilities/src/lib/shared/comparators.ts:19

Compares two elements lexicographically using the default comparison algorithm.

Type Parameters​

Type Parameter
ElementType

Parameters​

ParameterTypeDescription
xElementTypeThe first element to compare.
yElementTypeThe second element to compare.

Returns​

LexicographicComparison

The lexicographic comparison of the two elements.

Seealso​

23.1.3.30.2 CompareArrayElements (https://tc39.es/ecma262/#sec-comparearrayelements)

Remarks​

This function is used as the comparison algorithm for compareBy.