mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-14 22:08:45 +00:00
파일 및 디렉터리 목록을 정렬할 때 자연 정렬을 사용하도록 변경
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="ko">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ export enum SortBy {
|
|||||||
|
|
||||||
type SortFunc = (a?: string, b?: string) => number;
|
type SortFunc = (a?: string, b?: string) => number;
|
||||||
|
|
||||||
|
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });
|
||||||
|
|
||||||
const sortByNameAsc: SortFunc = (a, b) => {
|
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 (a) return -1;
|
||||||
if (b) return 1;
|
if (b) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user