Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: clean up sorting by key #1043

Open
TomBinford opened this issue May 18, 2023 · 1 comment
Open

Refactor: clean up sorting by key #1043

TomBinford opened this issue May 18, 2023 · 1 comment
Labels
good first issue Good for newcomers refactor Refactoring & cleanup

Comments

@TomBinford
Copy link
Contributor

const newList = programs.concat([]);
if (newList.size === 0) {

newList.sort((a, b) => {
if (a.name < b.name) return -1;
if (a.name === b.name) return 0;
// if (a.name > b.name) return 1;
return 1;
});
newList.forEach(({

We can rewrite this more functionally (without even a newList variable) using spread syntax and localeCompare

@mizlan mizlan added refactor Refactoring & cleanup good first issue Good for newcomers labels May 24, 2023
@mizlan
Copy link
Member

mizlan commented Nov 2, 2023

first issue may be fixed with TypeScript, since the concat is most likely there for dynamic conversion purposes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers refactor Refactoring & cleanup
Projects
None yet
Development

No branches or pull requests

2 participants