Updated compiler to sort cards numericly? by localids

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-05-02 00:21:04 +02:00
parent 20613a0b49
commit 4959a1b3ed
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6

View File

@ -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
}
})
} }