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:

committed by
Florian Müllner

parent
b87455c089
commit
f6b4b96737
@ -69,7 +69,7 @@ function _getCategories(info) {
|
||||
|
||||
function _listsIntersect(a, b) {
|
||||
for (let itemA of a)
|
||||
if (b.indexOf(itemA) >= 0)
|
||||
if (b.includes(itemA))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -1165,7 +1165,7 @@ var FolderIcon = class FolderIcon {
|
||||
let excludedApps = this._folder.get_strv('excluded-apps');
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
let addAppId = appId => {
|
||||
if (excludedApps.indexOf(appId) >= 0)
|
||||
if (excludedApps.includes(appId))
|
||||
return;
|
||||
|
||||
let app = appSys.lookup_app(appId);
|
||||
@ -1728,7 +1728,7 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
|
||||
let appInfo = this._source.app.get_app_info();
|
||||
let actions = appInfo.list_actions();
|
||||
if (this._source.app.can_open_new_window() &&
|
||||
actions.indexOf('new-window') == -1) {
|
||||
actions.includes('new-window')) {
|
||||
this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
|
||||
this._newWindowMenuItem.connect('activate', () => {
|
||||
if (this._source.app.state == Shell.AppState.STOPPED)
|
||||
@ -1742,7 +1742,7 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
|
||||
|
||||
if (discreteGpuAvailable &&
|
||||
this._source.app.state == Shell.AppState.STOPPED &&
|
||||
actions.indexOf('activate-discrete-gpu') == -1) {
|
||||
actions.includes('activate-discrete-gpu')) {
|
||||
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
|
||||
this._onDiscreteGpuMenuItem.connect('activate', () => {
|
||||
if (this._source.app.state == Shell.AppState.STOPPED)
|
||||
|
Reference in New Issue
Block a user