UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

30 lines 1.16 kB
//#region src/DataTable/sorting.d.ts type SortDirection = 'ASC' | 'DESC' | 'NONE'; declare const SortDirection: { [Key in SortDirection]: `${Key}` }; /** * A sort strategy for comparing any two values */ declare function basic<T>(a: T, b: T): -1 | 0 | 1; /** * A sort strategy for comparing two `Date` values. Also includes support for * values from `Date.now()` */ declare function datetime(a: Date | number, b: Date | number): number; /** * Compare two numbers using alphanumeric, or natural order, sorting. This * sorting function breaks up the inputs into groups of text and numbers and * compares the different sub-groups of each to determine the order of a set of * strings * * @see https://en.wikipedia.org/wiki/Natural_sort_order */ declare function alphanumeric(inputA: string, inputB: string): number; declare const strategies: { alphanumeric: typeof alphanumeric; basic: typeof basic; datetime: typeof datetime; }; type SortStrategy = keyof typeof strategies; type CustomSortStrategy<T> = (a: T, b: T) => number; //#endregion export { CustomSortStrategy, SortDirection, SortStrategy, alphanumeric, basic, datetime, strategies };