nhb-toolbox
Version:
A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.
14 lines • 832 B
TypeScript
import type { SortNature } from './types';
/**
* * Compare two strings using natural sorting (e.g., "file2" < "file10").
* Optionally supports case-insensitive and locale-aware string chunk comparisons.
*
* @param a - The first string to compare.
* @param b - The second string to compare.
* @param options - Optional settings to configure comparison behavior.
* @param options.caseInsensitive - If true, compares string chunks without case sensitivity. Defaults to `true`.
* @param options.localeAware - If true, uses localeCompare for string chunk comparisons. Defaults to `false`.
* @returns A negative number if `a` comes before `b`, a positive number if `a` comes after `b`, or 0 if equal.
*/
export declare function naturalSort(a: string, b: string, options?: SortNature): number;
//# sourceMappingURL=utils.d.ts.map