refactor: use Set instead of Array when appropriate (#39324)

This commit is contained in:
Milan Burda 2023-08-03 14:29:57 +02:00 committed by GitHub
parent c5e50e4882
commit fe93f69e5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -146,14 +146,14 @@ require('@electron/internal/browser/api/web-frame-main');
// Set main startup script of the app.
const mainStartupScript = packageJson.main || 'index.js';
const KNOWN_XDG_DESKTOP_VALUES = ['Pantheon', 'Unity:Unity7', 'pop:GNOME'];
const KNOWN_XDG_DESKTOP_VALUES = new Set(['Pantheon', 'Unity:Unity7', 'pop:GNOME']);
function currentPlatformSupportsAppIndicator () {
if (process.platform !== 'linux') return false;
const currentDesktop = process.env.XDG_CURRENT_DESKTOP;
if (!currentDesktop) return false;
if (KNOWN_XDG_DESKTOP_VALUES.includes(currentDesktop)) return true;
if (KNOWN_XDG_DESKTOP_VALUES.has(currentDesktop)) return true;
// ubuntu based or derived session (default ubuntu one, communitheme…) supports
// indicator too.
if (/ubuntu/ig.test(currentDesktop)) return true;