mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
utils: fix
This commit is contained in:
1 parent
dcc6a27bbc
commit
e89c5cd10e
2 files changed
+2
-2
No files matched your search
@@ -395,7 +395,7 @@ const fSortR = /[^\d]+|\d+/g;
|
|||||||
export function sortFiles(files: { _id: string }[] | string[]) {
|
export function sortFiles(files: { _id: string }[] | string[]) {
|
||||||
const isString = typeof files[0] === 'string';
|
const isString = typeof files[0] === 'string';
|
||||||
const result = files
|
const result = files
|
||||||
.map((i) => (isString ? { name: i, weights: i.match(fSortR) } : { ...i, weights: i.match(fSortR) }))
|
.map((i) => (isString ? { name: i, weights: i.match(fSortR) } : { ...i, weights: i._id.match(fSortR) }))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
let pos = 0;
|
let pos = 0;
|
||||||
const weightsA = a.weights;
|
const weightsA = a.weights;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/utils",
|
"name": "@hydrooj/utils",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"description": "hydrooj utils",
|
"description": "hydrooj utils",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
Reference in new issue
Block a user