-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes
sort-by
's handling of multiple keys (#375)
- Prior to this change, passing multiple keys to `sort-by` resulted in the target array being sorted by the first key and then the whole thing being resorted by each subsequent key. The ultimate result was determined solely by the last key. This is not the intended behavior. - The desired behavior (and the behavior of this addon prior to 4.1.0) is for the second and subsequent sort keys only to be applied in the case where the first sort key does not yield a clear ordering. - The test for this case uses the very common example of sorting people by last name then first name, as is shown in the README - This commit also consolidates the code path taken when a sort function is passed in place of a sort key
- Loading branch information
Showing
2 changed files
with
53 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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