remove localeCompare calls

This commit is contained in:
Robin Malfait 2024-03-07 19:27:20 +01:00
parent 1e0b35d836
commit 43eecb981a
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -40,7 +40,7 @@ export function getClassList(design: DesignSystem): ClassEntry[] {
}
}
list.sort((a, b) => a[0].localeCompare(b[0]))
list.sort((a, b) => (a[0] === b[0] ? 0 : a[0] < b[0] ? -1 : 1))
return list
}

View file

@ -469,7 +469,7 @@ export function createVariants(theme: Theme): Variants {
let order =
// Compare by bucket name
aBucket.localeCompare(zBucket) ||
(aBucket === zBucket ? 0 : aBucket < zBucket ? -1 : 1) ||
// If bucket names are the same, compare by value
(direction === 'asc'
? parseInt(aValue) - parseInt(zValue)
@ -489,7 +489,7 @@ export function createVariants(theme: Theme): Variants {
// In this scenario, we want to alphabetically sort `calc(100%-1rem)` and
// `calc(100%-2rem)` to make it deterministic.
if (Number.isNaN(order)) {
return aValue.localeCompare(zValue)
return aValue < zValue ? -1 : 1
}
return order