mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 21:33:02 +01:00
fix: apply natural sorting for item names (#607)
This commit is contained in:
@@ -249,13 +249,17 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const aLower = extractSortable(a, sortByProperty.value);
|
const aVal = extractSortable(a, sortByProperty.value);
|
||||||
const bLower = extractSortable(b, sortByProperty.value);
|
const bVal = extractSortable(b, sortByProperty.value);
|
||||||
|
|
||||||
if (aLower < bLower) {
|
if (typeof aVal === "string" && typeof bVal === "string") {
|
||||||
|
return aVal.localeCompare(bVal, undefined, { numeric: true, sensitivity: "base" });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aVal < bVal) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (aLower > bLower) {
|
if (aVal > bVal) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user