refactor(ags): use ?? operator for launcher sort func
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
89c02b408d
commit
c430505014
1 changed files with 3 additions and 7 deletions
|
@ -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;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue