cleanup: Use type-safe comparisons

We have been using type-safe comparisons in new code for quite a while
now, however old code has only been adapted slowly.

Change all the remaining bits to get rid of another legacy style
difference.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
This commit is contained in:
Florian Müllner
2023-08-07 02:51:19 +02:00
committed by Marge Bot
parent 9a3913d4a0
commit a42f7c2384
94 changed files with 847 additions and 845 deletions

View File

@ -104,7 +104,7 @@ class RunDialog extends ModalDialog.ModalDialog {
if (symbol === Clutter.KEY_Tab) {
let text = o.get_text();
let prefix;
if (text.lastIndexOf(' ') == -1)
if (text.lastIndexOf(' ') === -1)
prefix = text;
else
prefix = text.substr(text.lastIndexOf(' ') + 1);
@ -138,10 +138,10 @@ class RunDialog extends ModalDialog.ModalDialog {
let k = 0;
for (; k < s1.length && k < s2.length; k++) {
if (s1[k] != s2[k])
if (s1[k] !== s2[k])
break;
}
if (k == 0)
if (k === 0)
return '';
return s1.substr(0, k);
}
@ -156,7 +156,7 @@ class RunDialog extends ModalDialog.ModalDialog {
let info;
while ((info = fileEnum.next_file(null))) {
let name = info.get_name();
if (name.slice(0, text.length) == text)
if (name.slice(0, text.length) === text)
results.push(name);
}
} catch (e) {
@ -205,10 +205,10 @@ class RunDialog extends ModalDialog.ModalDialog {
} catch (e) {
// Mmmh, that failed - see if @input matches an existing file
let path = null;
if (input.charAt(0) == '/') {
if (input.charAt(0) === '/') {
path = input;
} else if (input) {
if (input.charAt(0) == '~')
if (input.charAt(0) === '~')
input = input.slice(1);
path = `${GLib.get_home_dir()}/${input}`;
}