refactor(ags): use ?? operator for launcher sort func
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-19 15:26:40 -04:00
parent 89c02b408d
commit c430505014

View file

@ -30,14 +30,10 @@ const Applauncher = (window_name = 'applauncher') => {
const row1 = (a.get_children()[0] as AgsAppItem).attribute.app.name; const row1 = (a.get_children()[0] as AgsAppItem).attribute.app.name;
const row2 = (b.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 s1 = fzfResults.find((r) => r.item.name === row1)?.score ?? 0;
const rowRes2 = fzfResults.find((r) => r.item.name === row2)?.score; const s2 = fzfResults.find((r) => r.item.name === row2)?.score ?? 0;
if (!rowRes1 || !rowRes2) { return s1 - s2;
return 0;
}
return rowRes1 - rowRes2;
}); });
}; };