From af2f744186855209ee35e727c25023544c501704 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Wed, 11 Nov 2020 09:43:17 -0800 Subject: [PATCH] use Array.includes --- src/common/Platform.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index ae23c02e..8838ca9d 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -23,17 +23,8 @@ export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent); // Find the users platform. We use this to interpret the meta key // and ISO third level shifts. // http://stackoverflow.com/q/19877924/577598 -export const isMac = contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform); +export const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform); export const isIpad = platform === 'iPad'; export const isIphone = platform === 'iPhone'; -export const isWindows = contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform); +export const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform); export const isLinux = platform.indexOf('Linux') >= 0; - -/** - * Return if the given array contains the given element - * @param arr The array to search for the given element. - * @param el The element to look for into the array - */ -function contains(arr: any[], el: any): boolean { - return arr.indexOf(el) >= 0; -}