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 Parameter | Description |
|---|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
a | T | First value to compare. |
b | T | Second value to compare. |
Returns
number
Negative if a goes before b, positive if after, zero if equal.