mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
파일 및 디렉터리 목록을 정렬할 때 자연 정렬을 사용하도록 변경
This commit is contained in:
@@ -5,8 +5,10 @@ export enum SortBy {
|
||||
|
||||
type SortFunc = (a?: string, b?: string) => number;
|
||||
|
||||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });
|
||||
|
||||
const sortByNameAsc: SortFunc = (a, b) => {
|
||||
if (a && b) return a.localeCompare(b);
|
||||
if (a && b) return collator.compare(a, b);
|
||||
if (a) return -1;
|
||||
if (b) return 1;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user