Skip to content

Commit

Permalink
sort via underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Oct 24, 2023
1 parent 87c35b8 commit 015cc04
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,17 +674,10 @@ function hasEnabledOptions(options) {
*/
function sortCategories(categories) {
// Sorts categories alphabetically by name.
const sortedCategories = _.values(categories).sort((a, b) => {
if (a.name < b.name) {
return -1;
}

if (a.name > b.name) {
return 1;
}

return 0;
});
const sortedCategories = _.chain(categories)
.values()
.sortBy((category) => category.name)
.value();

// An object that respects nesting of categories. Also, can contain only uniq categories.
const hierarchy = {};
Expand Down

0 comments on commit 015cc04

Please sign in to comment.