From 769aa87afb4b764021aa769956bcd000408ce5ca Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 4 Sep 2022 20:22:03 +0200 Subject: Sort case-insensitively --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server.js') diff --git a/server.js b/server.js index da29e0a..b11a766 100755 --- a/server.js +++ b/server.js @@ -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; }); } -- cgit v1.2.3-70-g09d2