compary
Version:
A library for composing complex compare-functions
11 lines (10 loc) • 447 B
TypeScript
interface Comparator<T> {
(a: T, b: T): number;
reversed(): Comparator<T>;
then(compare: (a: T, b: T) => number): Comparator<T>;
thenDescending(compare: (a: T, b: T) => number): Comparator<T>;
thenBy(selector: (value: T) => any): Comparator<T>;
thenByDescending(selector: (value: T) => any): Comparator<T>;
}
export default Comparator;
export declare function compare<T>(comparison: (a: T, b: T) => number): Comparator<T>;