import Comparator from "./Comparator"; /** * Defines various methods for constructing comparators. */ export default class ComparatorFactory { constructor(); /** * Constructs a new comparator where values are ordered by the given * comparison function. * * @param {(a: T, b: T) => number} comparison * @returns {Comparator} */ compare(comparison: (a: T, b: T) => number): Comparator; /** * Constructs a new comparator where values are ordered by the natural ascending order * of the property selected by the given `selector` function. * * @param {(value: T) => any} selector * @returns {Comparator} */ compareBy(selector: (value: T) => any): Comparator; /** * Constructs a new comparator where values are ordered by the natural ascending order * of values for the given `key`. * * @param {keyof T} key * @returns {Comparator} */ compareBy(key: keyof NonNullable): Comparator; /** * Constructs a new comparator where values are ordered by the natural descending order * of the property selected by the given `selector` function. * * @param {(value: T) => any} selector * @returns {Comparator} */ compareByDescending(selector: (value: T) => any): Comparator; /** * Constructs a new comparator where values are ordered by the natural descending order * of values for the given `key`. * * @param {keyof T} key * @returns {Comparator} */ compareByDescending(key: keyof NonNullable): Comparator; /** * Constructs a new comparator where values are ordered naturally. * * @returns {Comparator} */ naturalOrder(): Comparator; /** * Constructs a new comparator where values are ordered in reverse natural order. * * @returns {Comparator} */ reverseOrder(): Comparator; /** * Constructs a new comparator where null values are ordered at the beginning. * * @returns {Comparator} */ nullsFirst(): Comparator; /** * Constructs a new comparator where null values are ordered at the end. * * @returns {Comparator} */ nullsLast(): Comparator; }