Comparator for sorting and merging values.
Use the same comparator for every operation that expects an already sorted array. A negative return value means the first value comes before the second value.
const byAge: SortCallback<{ age: number }> = (a, b) => a.age - b.age; Copy
const byAge: SortCallback<{ age: number }> = (a, b) => a.age - b.age;
Compared value type.
Compares two values.
First value.
Second value.
A negative number when e1 sorts before e2, zero when they are equivalent, or a positive number when e1 sorts after e2.
e1
e2
Comparator for sorting and merging values.
Remarks
Use the same comparator for every operation that expects an already sorted array. A negative return value means the first value comes before the second value.
Example