From c43050501443bd646b7906fa3b34d4dd477d0791 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 19 Mar 2024 15:26:40 -0400 Subject: [PATCH] refactor(ags): use ?? operator for launcher sort func --- modules/ags/config/ts/applauncher/main.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/ags/config/ts/applauncher/main.ts b/modules/ags/config/ts/applauncher/main.ts index 9564bfaf..ab4807af 100644 --- a/modules/ags/config/ts/applauncher/main.ts +++ b/modules/ags/config/ts/applauncher/main.ts @@ -30,14 +30,10 @@ const Applauncher = (window_name = 'applauncher') => { const row1 = (a.get_children()[0] as AgsAppItem).attribute.app.name; const row2 = (b.get_children()[0] as AgsAppItem).attribute.app.name; - const rowRes1 = fzfResults.find((r) => r.item.name === row1)?.score; - const rowRes2 = fzfResults.find((r) => r.item.name === row2)?.score; + const s1 = fzfResults.find((r) => r.item.name === row1)?.score ?? 0; + const s2 = fzfResults.find((r) => r.item.name === row2)?.score ?? 0; - if (!rowRes1 || !rowRes2) { - return 0; - } - - return rowRes1 - rowRes2; + return s1 - s2; }); };