diff options
author | Tom Smeding <tom@tomsmeding.com> | 2022-09-04 20:22:03 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2022-09-04 20:23:12 +0200 |
commit | 769aa87afb4b764021aa769956bcd000408ce5ca (patch) | |
tree | 37f6944a407e235ab33834e8d28265e873c2638b /server.js | |
parent | 63712199736057d78a9adf19d57a9255aaf05307 (diff) |
Sort case-insensitively
Diffstat (limited to 'server.js')
-rwxr-xr-x | server.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -82,9 +82,10 @@ class Database { #sort() { this.#list.sort((a, b) => { + // ascending order would be "a - b" if (a[0] != b[0]) return b[0] - a[0]; - if (a[1] < b[1]) return -1; - if (a[1] > b[1]) return 1; + if (a[1].toLowerCase() < b[1].toLowerCase()) return -1; + if (a[1].toLowerCase() > b[1].toLowerCase()) return 1; return 0; }); } |