Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify locale options for strings #22

Closed
LinusU opened this issue Sep 21, 2022 · 1 comment · Fixed by #23
Closed

Ability to specify locale options for strings #22

LinusU opened this issue Sep 21, 2022 · 1 comment · Fixed by #23

Comments

@LinusU
Copy link
Contributor

LinusU commented Sep 21, 2022

We have a lot of arrays that we are sorting before presenting to a user. Since it's a Swedish app we are using the following code:

lhs.localeCompare(rhs, 'sv-SE', { numeric: true, sensitivity: 'accent' })

It would be great if there was a way to pass these options into the localeCompare call inside sort-on.

If you have any input on how the api would look I'd be happy to submit a PR 🚀

@sindresorhus
Copy link
Owner

Maybe a locales and localeOptions options where the latter is just passing through http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options ?

Alternatively, move locales into the the localeOptions, but that may make it harder to document and type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants