Skip to content

fix: ensure stable sort by normalizing localeCompare options#44

Merged
antfu merged 2 commits intoantfu:mainfrom
jinghaihan:fix/locale-compare-order
Dec 10, 2025
Merged

fix: ensure stable sort by normalizing localeCompare options#44
antfu merged 2 commits intoantfu:mainfrom
jinghaihan:fix/locale-compare-order

Conversation

@jinghaihan
Copy link
Contributor

localeCompare() depends on the host environment when the locales argument is not provided.
This caused unstable sorting results on different machines, especially for Chinese strings.

This PR fixes the issue by explicitly setting:

a.localeCompare(b, 'en', { numeric: true })

to ensure consistent and deterministic sorting behavior across environments.

This PR also migrates the build system from unbuild to tsdown.

@netlify
Copy link

netlify bot commented Dec 10, 2025

Deploy Preview for resonant-bonbon-a310e6 ready!

Name Link
🔨 Latest commit b7a33e1
🔍 Latest deploy log https://app.netlify.com/projects/resonant-bonbon-a310e6/deploys/69391a3ca3d0980008fd7cb6
😎 Deploy Preview https://deploy-preview-44--resonant-bonbon-a310e6.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu antfu merged commit 4bd6aeb into antfu:main Dec 10, 2025
9 checks passed
@jinghaihan jinghaihan deleted the fix/locale-compare-order branch December 10, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants