@nothing-but/platform
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -11,20 +11,20 @@ const w = typeof document === 'undefined' | ||
*/ | ||
/* Is Android Device */ | ||
export const isAndroid = /*#__PURE__*/ /Android/.test(ua); | ||
/* Is Windows Device */ | ||
export const isWindows = /*#__PURE__*/ /(win32|win64|windows|wince)/i.test(ua); | ||
/* Is Mac Device */ | ||
export const isMac = /*#__PURE__*/ /(macintosh|macintel|macppc|mac68k|macos)/i.test(ua); | ||
/* Is IPhone Device */ | ||
export const isIPhone = /*#__PURE__*/ /iphone/i.test(ua); | ||
/* Is IPad Device */ | ||
export const isIPad = /*#__PURE__*/ /ipad/i.test(ua) && n.maxTouchPoints > 1; | ||
/* Is IPod Device */ | ||
export const isIPod = /*#__PURE__*/ /ipod/i.test(ua); | ||
/* Is IOS Device */ | ||
export const isIOS = isIPhone || isIPad || isIPod; | ||
/* Is Apple Device */ | ||
export const isAppleDevice = isIOS || isMac; | ||
/* is a Mobile Browser */ | ||
export const isMobile = /*#__PURE__*/ /Mobi/.test(ua); | ||
/** Is Android Device */ | ||
export const is_android = /*#__PURE__*/ /Android/.test(ua); | ||
/** Is Windows Device */ | ||
export const is_windows = /*#__PURE__*/ /(win32|win64|windows|wince)/i.test(ua); | ||
/** Is Mac Device */ | ||
export const is_mac = /*#__PURE__*/ /(macintosh|macintel|macppc|mac68k|macos)/i.test(ua); | ||
/** Is IPhone Device */ | ||
export const is_iphone = /*#__PURE__*/ /iphone/i.test(ua); | ||
/** Is IPad Device */ | ||
export const is_ipad = /*#__PURE__*/ /ipad/i.test(ua) && n.maxTouchPoints > 1; | ||
/** Is IPod Device */ | ||
export const is_ipod = /*#__PURE__*/ /ipod/i.test(ua); | ||
/** Is IOS Device */ | ||
export const is_ios = is_iphone || is_ipad || is_ipod; | ||
/** Is Apple Device */ | ||
export const is_apple = is_ios || is_mac; | ||
/** is a Mobile Browser */ | ||
export const is_mobile = /*#__PURE__*/ /Mobi/.test(ua); | ||
/* | ||
@@ -35,8 +35,8 @@ | ||
*/ | ||
/* Browser is Mozilla Firefox */ | ||
export const isFirefox = /*#__PURE__*/ /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(ua); | ||
/* Browser is Opera */ | ||
export const isOpera = (!!w.opr && !!w.opr.addons) || !!w.opera || /*#__PURE__*/ / OPR\//.test(ua); | ||
/* Browser is Safari */ | ||
export const isSafari = !!(n.vendor && | ||
/** Browser is Mozilla Firefox */ | ||
export const is_firefox = /*#__PURE__*/ /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(ua); | ||
/** Browser is Opera */ | ||
export const is_opera = (!!w.opr && !!w.opr.addons) || !!w.opera || /*#__PURE__*/ / OPR\//.test(ua); | ||
/** Browser is Safari */ | ||
export const is_safari = !!(n.vendor && | ||
n.vendor.includes('Apple') && | ||
@@ -48,11 +48,13 @@ ua && | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
export const isIE = /*@cc_on!@*/ false || !!w.document.documentMode; | ||
/* is Chromium-based browser */ | ||
export const isChromium = !!w.chrome; | ||
/* Browser is Edge */ | ||
export const isEdge = /*#__PURE__*/ /Edg/.test(ua) && isChromium; | ||
/* Browser is Chrome */ | ||
export const isChrome = isChromium && n.vendor === 'Google Inc.' && !isOpera && !isEdge; | ||
/* Browser is Brave */ | ||
export const isBrave = !!(n.brave && n.brave.isBrave && n.brave.isBrave.name === 'isBrave'); | ||
export const is_ie = /*@cc_on!@*/ false || !!w.document.documentMode; | ||
/** is Chromium-based browser */ | ||
export const is_chromium = !!w.chrome; | ||
/** Browser is Edge */ | ||
export const is_edge = /*#__PURE__*/ /Edg/.test(ua) && is_chromium; | ||
/** Browser is Chrome */ | ||
export const is_chrome = is_chromium && n.vendor === 'Google Inc.' && !is_opera && !is_edge; | ||
/** Browser is Brave */ | ||
export const is_brave = !!(n.brave && | ||
n.brave.isBrave && | ||
n.brave.isBrave.name === 'isBrave'); | ||
/* | ||
@@ -63,13 +65,13 @@ | ||
*/ | ||
/* Browser using Gecko Rendering Engine */ | ||
export const isGecko = /*#__PURE__*/ /Gecko\/[0-9.]+/.test(ua); | ||
/* Browser using Blink Rendering Engine */ | ||
export const isBlink = /*#__PURE__*/ /Chrome\/[0-9.]+/.test(ua); | ||
/* Browser using WebKit Rendering Engine */ | ||
export const isWebKit = /*#__PURE__*/ /AppleWebKit\/[0-9.]+/.test(ua) && !isBlink; | ||
/* Browser using Presto Rendering Engine */ | ||
export const isPresto = /*#__PURE__*/ /Opera\/[0-9.]+/.test(ua); | ||
/* Browser using Trident Rendering Engine */ | ||
export const isTrident = /*#__PURE__*/ /Trident\/[0-9.]+/.test(ua); | ||
/* Browser using EdgeHTML Rendering Engine */ | ||
export const isEdgeHTML = /*#__PURE__*/ /Edge\/[0-9.]+/.test(ua); | ||
/** Browser using Gecko Rendering Engine */ | ||
export const is_gecko = /*#__PURE__*/ /Gecko\/[0-9.]+/.test(ua); | ||
/** Browser using Blink Rendering Engine */ | ||
export const is_blink = /*#__PURE__*/ /Chrome\/[0-9.]+/.test(ua); | ||
/** Browser using WebKit Rendering Engine */ | ||
export const is_webkit = /*#__PURE__*/ /AppleWebKit\/[0-9.]+/.test(ua) && !is_blink; | ||
/** Browser using Presto Rendering Engine */ | ||
export const is_presto = /*#__PURE__*/ /Opera\/[0-9.]+/.test(ua); | ||
/** Browser using Trident Rendering Engine */ | ||
export const is_trident = /*#__PURE__*/ /Trident\/[0-9.]+/.test(ua); | ||
/** Browser using EdgeHTML Rendering Engine */ | ||
export const is_edge_html = /*#__PURE__*/ /Edge\/[0-9.]+/.test(ua); |
@@ -18,26 +18,48 @@ declare global { | ||
} | ||
export declare const isAndroid: boolean; | ||
export declare const isWindows: boolean; | ||
export declare const isMac: boolean; | ||
export declare const isIPhone: boolean; | ||
export declare const isIPad: boolean; | ||
export declare const isIPod: boolean; | ||
export declare const isIOS: boolean; | ||
export declare const isAppleDevice: boolean; | ||
export declare const isMobile: boolean; | ||
export declare const isFirefox: boolean; | ||
export declare const isOpera: boolean; | ||
export declare const isSafari: boolean; | ||
/** Is Android Device */ | ||
export declare const is_android: boolean; | ||
/** Is Windows Device */ | ||
export declare const is_windows: boolean; | ||
/** Is Mac Device */ | ||
export declare const is_mac: boolean; | ||
/** Is IPhone Device */ | ||
export declare const is_iphone: boolean; | ||
/** Is IPad Device */ | ||
export declare const is_ipad: boolean; | ||
/** Is IPod Device */ | ||
export declare const is_ipod: boolean; | ||
/** Is IOS Device */ | ||
export declare const is_ios: boolean; | ||
/** Is Apple Device */ | ||
export declare const is_apple: boolean; | ||
/** is a Mobile Browser */ | ||
export declare const is_mobile: boolean; | ||
/** Browser is Mozilla Firefox */ | ||
export declare const is_firefox: boolean; | ||
/** Browser is Opera */ | ||
export declare const is_opera: boolean; | ||
/** Browser is Safari */ | ||
export declare const is_safari: boolean; | ||
/** Browser is Internet Explorer 6-11 */ | ||
export declare const isIE: boolean; | ||
export declare const isChromium: boolean; | ||
export declare const isEdge: boolean; | ||
export declare const isChrome: boolean; | ||
export declare const isBrave: boolean; | ||
export declare const isGecko: boolean; | ||
export declare const isBlink: boolean; | ||
export declare const isWebKit: boolean; | ||
export declare const isPresto: boolean; | ||
export declare const isTrident: boolean; | ||
export declare const isEdgeHTML: boolean; | ||
export declare const is_ie: boolean; | ||
/** is Chromium-based browser */ | ||
export declare const is_chromium: boolean; | ||
/** Browser is Edge */ | ||
export declare const is_edge: boolean; | ||
/** Browser is Chrome */ | ||
export declare const is_chrome: boolean; | ||
/** Browser is Brave */ | ||
export declare const is_brave: boolean; | ||
/** Browser using Gecko Rendering Engine */ | ||
export declare const is_gecko: boolean; | ||
/** Browser using Blink Rendering Engine */ | ||
export declare const is_blink: boolean; | ||
/** Browser using WebKit Rendering Engine */ | ||
export declare const is_webkit: boolean; | ||
/** Browser using Presto Rendering Engine */ | ||
export declare const is_presto: boolean; | ||
/** Browser using Trident Rendering Engine */ | ||
export declare const is_trident: boolean; | ||
/** Browser using EdgeHTML Rendering Engine */ | ||
export declare const is_edge_html: boolean; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,20 +11,20 @@ const w = typeof document === 'undefined' | ||
*/ | ||
/* Is Android Device */ | ||
export const isAndroid = /*#__PURE__*/ /Android/.test(ua); | ||
/* Is Windows Device */ | ||
export const isWindows = /*#__PURE__*/ /(win32|win64|windows|wince)/i.test(ua); | ||
/* Is Mac Device */ | ||
export const isMac = /*#__PURE__*/ /(macintosh|macintel|macppc|mac68k|macos)/i.test(ua); | ||
/* Is IPhone Device */ | ||
export const isIPhone = /*#__PURE__*/ /iphone/i.test(ua); | ||
/* Is IPad Device */ | ||
export const isIPad = /*#__PURE__*/ /ipad/i.test(ua) && n.maxTouchPoints > 1; | ||
/* Is IPod Device */ | ||
export const isIPod = /*#__PURE__*/ /ipod/i.test(ua); | ||
/* Is IOS Device */ | ||
export const isIOS = isIPhone || isIPad || isIPod; | ||
/* Is Apple Device */ | ||
export const isAppleDevice = isIOS || isMac; | ||
/* is a Mobile Browser */ | ||
export const isMobile = /*#__PURE__*/ /Mobi/.test(ua); | ||
/** Is Android Device */ | ||
export const is_android = /*#__PURE__*/ /Android/.test(ua); | ||
/** Is Windows Device */ | ||
export const is_windows = /*#__PURE__*/ /(win32|win64|windows|wince)/i.test(ua); | ||
/** Is Mac Device */ | ||
export const is_mac = /*#__PURE__*/ /(macintosh|macintel|macppc|mac68k|macos)/i.test(ua); | ||
/** Is IPhone Device */ | ||
export const is_iphone = /*#__PURE__*/ /iphone/i.test(ua); | ||
/** Is IPad Device */ | ||
export const is_ipad = /*#__PURE__*/ /ipad/i.test(ua) && n.maxTouchPoints > 1; | ||
/** Is IPod Device */ | ||
export const is_ipod = /*#__PURE__*/ /ipod/i.test(ua); | ||
/** Is IOS Device */ | ||
export const is_ios = is_iphone || is_ipad || is_ipod; | ||
/** Is Apple Device */ | ||
export const is_apple = is_ios || is_mac; | ||
/** is a Mobile Browser */ | ||
export const is_mobile = /*#__PURE__*/ /Mobi/.test(ua); | ||
/* | ||
@@ -35,8 +35,8 @@ | ||
*/ | ||
/* Browser is Mozilla Firefox */ | ||
export const isFirefox = /*#__PURE__*/ /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(ua); | ||
/* Browser is Opera */ | ||
export const isOpera = (!!w.opr && !!w.opr.addons) || !!w.opera || /*#__PURE__*/ / OPR\//.test(ua); | ||
/* Browser is Safari */ | ||
export const isSafari = !!(n.vendor && | ||
/** Browser is Mozilla Firefox */ | ||
export const is_firefox = /*#__PURE__*/ /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(ua); | ||
/** Browser is Opera */ | ||
export const is_opera = (!!w.opr && !!w.opr.addons) || !!w.opera || /*#__PURE__*/ / OPR\//.test(ua); | ||
/** Browser is Safari */ | ||
export const is_safari = !!(n.vendor && | ||
n.vendor.includes('Apple') && | ||
@@ -48,11 +48,13 @@ ua && | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
export const isIE = /*@cc_on!@*/ false || !!w.document.documentMode; | ||
/* is Chromium-based browser */ | ||
export const isChromium = !!w.chrome; | ||
/* Browser is Edge */ | ||
export const isEdge = /*#__PURE__*/ /Edg/.test(ua) && isChromium; | ||
/* Browser is Chrome */ | ||
export const isChrome = isChromium && n.vendor === 'Google Inc.' && !isOpera && !isEdge; | ||
/* Browser is Brave */ | ||
export const isBrave = !!(n.brave && n.brave.isBrave && n.brave.isBrave.name === 'isBrave'); | ||
export const is_ie = /*@cc_on!@*/ false || !!w.document.documentMode; | ||
/** is Chromium-based browser */ | ||
export const is_chromium = !!w.chrome; | ||
/** Browser is Edge */ | ||
export const is_edge = /*#__PURE__*/ /Edg/.test(ua) && is_chromium; | ||
/** Browser is Chrome */ | ||
export const is_chrome = is_chromium && n.vendor === 'Google Inc.' && !is_opera && !is_edge; | ||
/** Browser is Brave */ | ||
export const is_brave = !!(n.brave && | ||
n.brave.isBrave && | ||
n.brave.isBrave.name === 'isBrave'); | ||
/* | ||
@@ -63,13 +65,13 @@ | ||
*/ | ||
/* Browser using Gecko Rendering Engine */ | ||
export const isGecko = /*#__PURE__*/ /Gecko\/[0-9.]+/.test(ua); | ||
/* Browser using Blink Rendering Engine */ | ||
export const isBlink = /*#__PURE__*/ /Chrome\/[0-9.]+/.test(ua); | ||
/* Browser using WebKit Rendering Engine */ | ||
export const isWebKit = /*#__PURE__*/ /AppleWebKit\/[0-9.]+/.test(ua) && !isBlink; | ||
/* Browser using Presto Rendering Engine */ | ||
export const isPresto = /*#__PURE__*/ /Opera\/[0-9.]+/.test(ua); | ||
/* Browser using Trident Rendering Engine */ | ||
export const isTrident = /*#__PURE__*/ /Trident\/[0-9.]+/.test(ua); | ||
/* Browser using EdgeHTML Rendering Engine */ | ||
export const isEdgeHTML = /*#__PURE__*/ /Edge\/[0-9.]+/.test(ua); | ||
/** Browser using Gecko Rendering Engine */ | ||
export const is_gecko = /*#__PURE__*/ /Gecko\/[0-9.]+/.test(ua); | ||
/** Browser using Blink Rendering Engine */ | ||
export const is_blink = /*#__PURE__*/ /Chrome\/[0-9.]+/.test(ua); | ||
/** Browser using WebKit Rendering Engine */ | ||
export const is_webkit = /*#__PURE__*/ /AppleWebKit\/[0-9.]+/.test(ua) && !is_blink; | ||
/** Browser using Presto Rendering Engine */ | ||
export const is_presto = /*#__PURE__*/ /Opera\/[0-9.]+/.test(ua); | ||
/** Browser using Trident Rendering Engine */ | ||
export const is_trident = /*#__PURE__*/ /Trident\/[0-9.]+/.test(ua); | ||
/** Browser using EdgeHTML Rendering Engine */ | ||
export const is_edge_html = /*#__PURE__*/ /Edge\/[0-9.]+/.test(ua); |
{ | ||
"name": "@nothing-but/platform", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>", |
@@ -18,9 +18,9 @@ # @nothing-but/platform | ||
```ts | ||
import {isWebKit, isFirefox} from '@nothing-but/platform' | ||
import {is_webkit, is_firefox} from '@nothing-but/platform' | ||
if (!isFirefox) { | ||
if (!is_firefox) { | ||
// won't run on the Mozilla Firefox Browser | ||
} | ||
if (isWebKit) { | ||
if (is_webkit) { | ||
// run WebKit Engine specific code | ||
@@ -38,51 +38,51 @@ } | ||
- `isAndroid` — Is Android Device | ||
- `is_android` — Is Android Device | ||
- `isWindows` — Is Windows Device | ||
- `is_windows` — Is Windows Device | ||
- `isMac` — Is Mac Device | ||
- `is_mac` — Is Mac Device | ||
- `isIPhone` — Is IPhone Device | ||
- `is_iphone` — Is IPhone Device | ||
- `isIPad` — Is IPad Device | ||
- `is_ipad` — Is IPad Device | ||
- `isIPod` — Is IPod Device | ||
- `is_ipod` — Is IPod Device | ||
- `isIOS` — Is IOS Device | ||
- `is_ios` — Is IOS Device | ||
- `isAppleDevice` — Is Apple Device | ||
- `is_apple_device` — Is Apple Device | ||
- `isMobile` — is a Mobile Browser | ||
- `is_mobile` — is a Mobile Browser | ||
### Browsers | ||
- `isFirefox` — Browser is Mozilla Firefox | ||
- `is_firefox` — Browser is Mozilla Firefox | ||
- `isOpera` — Browser is Opera | ||
- `is_opera` — Browser is Opera | ||
- `isSafari` — Browser is Safari | ||
- `is_safari` — Browser is Safari | ||
- `isIE` — Browser is Internet Explorer | ||
- `is_ie` — Browser is Internet Explorer | ||
- `isChromium` — is Chromium-based browser | ||
- `is_chromium` — is Chromium-based browser | ||
- `isEdge` — Browser is Edge | ||
- `is_edge` — Browser is Edge | ||
- `isChrome` — Browser is Chrome | ||
- `is_chrome` — Browser is Chrome | ||
- `isBrave` — Browser is Brave | ||
- `is_brave` — Browser is Brave | ||
### Rendering Engines | ||
- `isGecko` — Browser using Gecko Rendering Engine | ||
- `is_gecko` — Browser using Gecko Rendering Engine | ||
- `isBlink` — Browser using Blink Rendering Engine | ||
- `is_blink` — Browser using Blink Rendering Engine | ||
- `isWebKit` — Browser using WebKit Rendering Engine | ||
- `is_webkit` — Browser using WebKit Rendering Engine | ||
- `isPresto` — Browser using Presto Rendering Engine | ||
- `is_presto` — Browser using Presto Rendering Engine | ||
- `isTrident` — Browser using Trident Rendering Engine | ||
- `is_trident` — Browser using Trident Rendering Engine | ||
- `isEdgeHTML` — Browser using EdgeHTML Rendering Engine | ||
- `is_edge_html` — Browser using EdgeHTML Rendering Engine | ||
@@ -89,0 +89,0 @@ ## Changelog |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12638
197