Skip to content

Commit

Permalink
Add comment about tie-breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
lynn committed Jan 4, 2024
1 parent 584bca9 commit 367d110
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ function sortify(s) {
.replace(/ı/g, "i")
.replace(//g, "v")
.replace(/[^a-z\ ]/g, "");

// It doesn't look like Array.sort is stable, so we'll tack on the original
// string at the end of the sort key. For example "dâ" is sorted as "da,dâ".
// This basically has the effect of ignoring diacritics in a primary sort but
// then deferring to them as a tie-breaker.
return normal + "," + s;
}

Expand Down

0 comments on commit 367d110

Please sign in to comment.