+2
-11
@@ -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
|
// Find the users platform. We use this to interpret the meta key
|
||||||
// and ISO third level shifts.
|
// and ISO third level shifts.
|
||||||
// http://stackoverflow.com/q/19877924/577598
|
// 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 isIpad = platform === 'iPad';
|
||||||
export const isIphone = platform === 'iPhone';
|
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;
|
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;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user