Skip to content

ts-ds / CompareFn

Type Alias: CompareFn<T> ​

ts
type CompareFn<T> = (a, b) => number;

Defined in: sort/utils.ts:11

Comparison function used by comparison sorts.

Must define a consistent order (a strict weak ordering), exactly like the comparator of Array.prototype.sort.

Type Parameters ​

Type ParameterDescription
T

Parameters ​

ParameterTypeDescription
aTFirst value to compare.
bTSecond value to compare.

Returns ​

number

Negative if a goes before b, positive if after, zero if equal.

MIT License