natsort-esm
Version:
Natural sort algorithm
19 lines (18 loc) • 644 B
TypeScript
export type NatsortOptions = {
/**
* Desc sorting.
*/
desc?: boolean;
/**
* Case-insensitive sorting.
*/
insensitive?: boolean;
/**
* Whether numeric tokenization should be applied only to whole numbers, not
* attempting to resolve fractals. Useful to tokenize pure semver strings. For example,
* the default behavior will tokenize '1.10.0' as ['1.1', '0'], causing '1.9.0' to be
* greater. Tokenizing only whole numbers yields ['1', '10', '0'].
*/
tokenizeWholeNumbersOnly?: boolean;
};
export declare const natsort: <T>(options?: NatsortOptions) => (a: T, b: T) => number;