mirror of
https://github.com/tcgdex/compiler.git
synced 2025-04-22 10:42:09 +00:00
Updated compiler to sort cards numericly? by localids
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
20613a0b49
commit
4959a1b3ed
@ -136,7 +136,15 @@ export async function getCards(lang: SupportedLanguages,set?: Set): Promise<Arra
|
|||||||
}
|
}
|
||||||
list.push([id, c])
|
list.push([id, c])
|
||||||
}
|
}
|
||||||
// console.log(list[0], list[0][0])
|
|
||||||
// process.exit(0)
|
// Sort by id when possible
|
||||||
return list
|
return list.sort(([a], [b]) => {
|
||||||
|
const ra = parseInt(a)
|
||||||
|
const rb = parseInt(b)
|
||||||
|
if (!isNaN(ra) && !isNaN(rb)) {
|
||||||
|
return ra - rb
|
||||||
|
} else {
|
||||||
|
return a >= b ? 1 : -1
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user