This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(orderBy): consider
null
and undefined
greater than other values
Previously, `null` values where sorted using type `string` resulting in a string comparison. `undefined` values where compared to other values by type and were usually considered greater than other values (since their type happens to start with a `u`), but this was coincidental. This commit ensures that `null` and `undefined ` values are explicitly considered greater than other values (with `undefined` > `null`) and will effectively be put at the end of the sorted list (for ascending order sorting). Closes #15294 Closes #16376 BREAKING CHANGE: When using `orderBy` to sort arrays containing `null` values, the `null` values will be considered "greater than" all other values, except for `undefined`. Previously, they were sorted as strings. This will result in different (but more intuitive) sorting order. Before: ```js orderByFilter(['a', undefined, 'o', null, 'z']); //--> 'a', null, 'o', 'z', undefined ``` After: ```js orderByFilter(['a', undefined, 'o', null, 'z']); //--> 'a', 'o', 'z', null, undefined ```
- Loading branch information
1 parent
40c4990
commit 1d80464
Showing
2 changed files
with
30 additions
and
11 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