[polari] joinDialog: Use localeCompare() for name sorting



commit 5782a98c6e3dc5c3e20894348832edaf05a5be50
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 7 00:19:45 2019 +0200

    joinDialog: Use localeCompare() for name sorting
    
    It's much less obscure than a greater/lesser-than comparisons on strings
    in a nested trinary expression.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/133

 src/joinDialog.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 1ecfad1..927509b 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -183,7 +183,7 @@ var JoinDialog = GObject.registerClass({
         this._connectionCombo.remove_all();
 
         let names = [...this._accounts.keys()].sort((a, b) => {
-            return (a < b) ? -1 : ((a > b) ? 1 : 0);
+            return a.localeCompare(b);
         });
         for (let i = 0; i < names.length; i++)
             this._connectionCombo.append(names[i], names[i]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]