fix: use Intl.Collator for string sorting when available#3809
Merged
isaacs merged 1 commit intorelease-nextfrom Sep 28, 2021
Merged
fix: use Intl.Collator for string sorting when available#3809isaacs merged 1 commit intorelease-nextfrom
isaacs merged 1 commit intorelease-nextfrom
Conversation
0c7fb02 to
1578490
Compare
wraithgar
reviewed
Sep 28, 2021
|
|
||
| // sorts list alphabetically | ||
| const outdated = this.list.sort((a, b) => a.name.localeCompare(b.name, 'en')) | ||
| const outdated = this.list.sort(({ name: a }, { name: b }) => localeCompare(a, b) |
Member
There was a problem hiding this comment.
Suggested change
| const outdated = this.list.sort(({ name: a }, { name: b }) => localeCompare(a, b) | |
| const outdated = this.list.sort(({ name: a }, { name: b }) => localeCompare(a, b)) |
Contributor
Author
There was a problem hiding this comment.
Ha, fixed that one locally, but neglected to add it to my amended commit. Thanks.
351b2fb to
7b0cd12
Compare
wraithgar
reviewed
Sep 28, 2021
| .filter(i => (i.depth - 1) <= depth) | ||
| .sort((a, b) => a.depth - b.depth) | ||
| .sort((a, b) => a.depth === b.depth ? a.name.localeCompare(b.name, 'en') : 0) | ||
| .sort((a, b) => (a.depth - b.depth) || localeCompare(a.name, b.name)) |
wraithgar
approved these changes
Sep 28, 2021
Member
wraithgar
left a comment
There was a problem hiding this comment.
Bonus! Lots of little improvements to all these sort functions.
The npm/cli form of npm/arborist#324 Required adding options support to package used for this. PR-URL: #3809 Credit: @isaacs Close: #3809 Reviewed-by: @wraithgar
7b0cd12 to
dbb90f7
Compare
Contributor
Author
Yeah, that double-sort on installedDeep was a bit of a head-scratcher. |
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.
The npm/cli form of npm/arborist#324
Required adding options support to package used for this.
References