Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Added alphabetic sorting of groups. #24

Merged
merged 1 commit into from
Feb 12, 2016

Conversation

FlorianJunghanns
Copy link
Contributor

This makes it possible to toggle between internal (currently creation time based) sorting of tab groups and alphabetic sorting in the UI.

} else {
return 0;
}
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else after a return statement is somewhat useless since it would never reach the code if the block above was true. You could simply omit the elses (which is was eslint suggests here). However, there is an even "nicer" (as in shorter) way of writing this sort code:

retGroups.sort((a, b) => {
  if (a.title == b.title) {
    return 0;
  }

  return a.title < b.title ? -1 : 1;
});

I tend to avoid ternary operation, but in such simple cases as deciding between 1 and -1, they are perfectly valid and easy to understand.

@denschub denschub added this to the 0.2.0 milestone Feb 11, 2016
@denschub
Copy link
Owner

This is looking very good already, thank you so much for contributing! I've added a suggestion above. When done, could you please squash your commits into a single commit?

@denschub
Copy link
Owner

Merged, thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants