import { primitive } from '../primitive'; import { spatial } from '../spatial'; export type Comparator = (a: T, b: T) => number; /** * Creates the appropriate compare function for sorting the given * primitive type. * * @param v The primitive value to create a compare function for. * This is used to determine the type of comparison to perform. * @param reverse Whether to reverse the sort order. */ export declare const newF: (v: T, reverse?: boolean) => Comparator; /** * Creates a compare function that compares the field of the given object. * * @param key The key of the field to compare. * @param value The object to compare the field of. This is used to determine the type of * comparison to perform. * @param reverse Whether to reverse the sort order. */ export declare const newFieldF: (key: keyof T, value: T, reverse?: boolean) => Comparator; /** * Compares the two primitive arrays. * @param a The first array to compare. * @param b The second array to compare. * @returns The array with the greater length if the array lengths are not equal. If the * arrays are the same length, returns 0 if all elements are equal, otherwise returns -1. */ export declare const primitiveArrays: (a: readonly T[] | T[], b: readonly T[] | T[]) => number; export declare const unorderedPrimitiveArrays: (a: readonly T[] | T[], b: readonly T[] | T[]) => number; export declare const uniqueUnorderedPrimitiveArrays: (a: readonly T[] | T[], b: readonly T[] | T[]) => number; /** * Returns true if the two maps have the same set of keys and each value is * identity-equal (===). Intended for use as a reference-stability comparator * (e.g. React's `useSyncExternalStoreWithSelector`) where the values are * already reference-stable in storage (e.g. Immer state). For deeper value * comparison, compose with `deep.equal` at the call site. */ export declare const mapsEqual: (a: Map, b: Map) => boolean; /** * Returns true if the two arrays have the same length and each element is * identity-equal (===). Same use case as `mapsEqual` for selectors that * derive arrays from reference-stable storage. */ export declare const arraysEqual: (a: readonly T[] | T[], b: readonly T[] | T[]) => boolean; export declare const order: (a: spatial.Order, b: spatial.Order) => number; /** @returns the reverse of the given compare function. */ export declare const reverseF: (f: Comparator) => Comparator; /** The equal return value of a compare function. */ export declare const EQUAL = 0; /** The less than return value of a compare function. */ export declare const LESS_THAN = -1; /** The greater than return value of a compare function. */ export declare const GREATER_THAN = 1; /** @returns true if the result of the comparison is less than 0. */ export declare const isLessThan: (n: number) => boolean; /** @returns true if the result of the comparison is greater than 0. */ export declare const isGreaterThan: (n: number) => boolean; /** @returns true if the result of the comparison is equal to 0. */ export declare const isGreaterThanEqual: (n: number) => boolean; /** @returns true if the result of the comparison is equal to 0. */ export declare const isEqualTo: (n: number) => boolean; export declare const stringsWithNumbers: (a: string, b: string) => number; //# sourceMappingURL=compare.d.ts.map