cleanup: Use Array.includes() to check for element existence

We can use that newer method where we don't care about the actual position
of an element inside the array.

(Array.includes() and Array.indexOf() do behave differently in edge cases,
for example in the handling of NaN, but those don't matter to us)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/152
This commit is contained in:
Florian Müllner
2018-07-14 22:56:22 +02:00
committed by Florian Müllner
parent b87455c089
commit f6b4b96737
29 changed files with 49 additions and 50 deletions

View File

@ -582,12 +582,12 @@ class ExtensionRow extends Gtk.ListBoxRow {
_isEnabled() {
let extensions = this._settings.get_strv('enabled-extensions');
return extensions.indexOf(this.uuid) != -1;
return extensions.includes(this.uuid);
}
_enable() {
let extensions = this._settings.get_strv('enabled-extensions');
if (extensions.indexOf(this.uuid) != -1)
if (extensions.includes(this.uuid))
return;
extensions.push(this.uuid);