Skip to content

Commit

Permalink
Improve lexicon orting
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobrasolin committed Jan 24, 2024
1 parent 0481071 commit 0b9438d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/controllers/lexicon_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ export default class extends Controller {
(d) => d.word,
);

// TODO: improve sorting? Maybe do it on first init by count?
const sorted = Array.from(countByWord).sort(([a], [b]) =>
a.localeCompare(b),
);
//const sorted = Array.from(countByWord).sort(([x, a], [y, b]) => b - a);
const sorted = Array.from(countByWord)
.sort(([a], [b]) => a.localeCompare(b))
.sort(([, a], [, b]) => b - a);

d3.select(this.selectTarget)
.selectAll<HTMLOptionElement, [string, number]>("option")
Expand Down

0 comments on commit 0b9438d

Please sign in to comment.