import type { Comparator } from "@rickosborne/typical"; /** * Mixin for a comparator with chaining functions to constrain * the behavior of the comparator. */ export type ChainableComparator = Comparator & { /** * Reverse the comparator. */ get desc(): ChainableComparator; /** * Return null and undefined values before the rest. */ get nullsFirst(): ChainableComparator; /** * Return null and undefined values after the rest. */ get nullsLast(): ChainableComparator; }; /** * Wrap the given comparator to return null and undefined values * before the others. */ export declare const withNullsFirst: (comparator: Comparator) => Comparator; /** * Wrap the given comparator to return null and undefined values * after the others. */ export declare const withNullsLast: (comparator: Comparator) => Comparator; /** * Wrap the given comparator so you can chain {@link ChainableComparator} * functions from it. */ export declare const chainableComparator: (comparator: Comparator) => ChainableComparator; /** * Numeric comparator which sorts lower values before higher ones. */ export declare const numberAsc: Comparator; /** * Numeric (reverse) comparator which sorts higher values before lower ones. */ export declare const numberDesc: Comparator; /** * String comparator which sorts in lexicographic (dictionary) order. */ export declare const stringAsc: Comparator; /** * String comparator which sorts in reverse lexicographic (dictionary) order. */ export declare const stringDesc: Comparator; /** * Build a comparator for the given type, which goes through the * specified checks in the order they are defined. */ export type ComparatorBuilder = { /** * Return the generated comparator. */ build(): Comparator; /** * Invert the previous comparator. */ get desc(): ComparatorBuilder; /** * Have the previous comparator return null and undefined values before others. */ get nullsFirst(): ComparatorBuilder; /** * Have the previous comparator return null and undefined values after others. */ get nullsLast(): ComparatorBuilder; /** * Add comparator which first accesses a numeric value, often * a property value, from the compared type. */ num(accessor: (t: T) => (undefined | number)): ComparatorBuilder; /** * Add comparator which first accesses a string value, often * a property value, from the compared type. */ str(accessor: (t: T) => (undefined | string)): ComparatorBuilder; }; /** * Start building a comparator. */ export declare const comparatorBuilder: () => ComparatorBuilder; //# sourceMappingURL=comparator.d.ts.map