@socketsecurity/lib
Version:
Core utilities and infrastructure for Socket.dev security tools
29 lines (28 loc) • 901 B
TypeScript
/**
* Compare two strings using locale-aware comparison.
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function localeCompare(x: string, y: string): number;
/**
* Compare two strings using natural sorting (numeric-aware, case-insensitive).
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function naturalCompare(x: string, y: string): number;
// Type for fast-sort sorter function.
type FastSortFunction = ReturnType<typeof import('fast-sort').createNewSortInstance>;
/**
* Sort an array using natural comparison.
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function naturalSorter<T>(arrayToSort: T[]): ReturnType<FastSortFunction>;
/**
* Simple string comparison.
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function compareStr(a: string, b: string): number;
/**
* Compare semantic versions.
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function compareSemver(a: string, b: string): number;
export {};