feat(pinia-orm): support Intl.Collator for locale aware sorting#2033
Merged
Conversation
orderBy() (query & repository), useSortBy and the orderBy util now accept an Intl.Collator besides the existing sort flags. String values are then compared with the collator, enabling locale aware ordering (e.g. Lithuanian A, B, Š, T, U) and options like numeric sorting. Different flags can be given per order clause. closes #2006
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2033 +/- ##
==========================================
- Coverage 99.40% 99.30% -0.10%
==========================================
Files 82 82
Lines 3025 3030 +5
Branches 533 539 +6
==========================================
+ Hits 3007 3009 +2
Misses 15 15
- Partials 3 6 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature (#2006)
orderBy()sorted strings by code point, so non-English characters ended up in the wrong place (ŠafterUinstead of betweenBandTin Lithuanian).orderBy()on query & repository,useSortBy()/collect().sortBy()and the exportedorderByutil now accept anIntl.Collatorin addition to the existingSortFlags:orderBy()can carry its own flag/collator (per-criterion flags array internally).{ numeric: true }, case options etc. for free.orderBy()API page +useSortBy()helper page).Tests
3 new tests: repository sort with
ltcollator, util-level collator sort, per-field mixed flags. Full suite green (412 tests).closes #2006