detect-browser
Advanced tools
Comparing version 5.0.0 to 5.1.0
/// <reference types="node" /> | ||
export declare type DetectedInfoType = 'browser' | 'node' | 'bot-device' | 'bot'; | ||
export declare type DetectedInfoType = 'browser' | 'node' | 'bot-device' | 'bot' | 'react-native'; | ||
interface DetectedInfo<T extends DetectedInfoType, N extends string, O, V = null> { | ||
@@ -38,5 +38,11 @@ readonly type: T; | ||
} | ||
export declare class ReactNativeInfo implements DetectedInfo<'react-native', 'react-native', null, null> { | ||
readonly type = "react-native"; | ||
readonly name: 'react-native'; | ||
readonly version: null; | ||
readonly os: null; | ||
} | ||
export declare type Browser = 'aol' | 'edge' | 'edge-ios' | 'yandexbrowser' | 'kakaotalk' | 'samsung' | 'silk' | 'miui' | 'beaker' | 'edge-chromium' | 'chrome' | 'chromium-webview' | 'phantomjs' | 'crios' | 'firefox' | 'fxios' | 'opera-mini' | 'opera' | 'ie' | 'bb10' | 'android' | 'ios' | 'safari' | 'facebook' | 'instagram' | 'ios-webview' | 'searchbot'; | ||
export declare type OperatingSystem = 'iOS' | 'Android OS' | 'BlackBerry OS' | 'Windows Mobile' | 'Amazon OS' | 'Windows 3.11' | 'Windows 95' | 'Windows 98' | 'Windows 2000' | 'Windows XP' | 'Windows Server 2003' | 'Windows Vista' | 'Windows 7' | 'Windows 8' | 'Windows 8.1' | 'Windows 10' | 'Windows ME' | 'Open BSD' | 'Sun OS' | 'Linux' | 'Mac OS' | 'QNX' | 'BeOS' | 'OS/2' | 'Chrome OS'; | ||
export declare function detect(userAgent?: string): BrowserInfo | SearchBotDeviceInfo | BotInfo | NodeInfo | null; | ||
export declare function detect(userAgent?: string): BrowserInfo | SearchBotDeviceInfo | BotInfo | NodeInfo | ReactNativeInfo | null; | ||
export declare function browserName(ua: string): Browser | null; | ||
@@ -43,0 +49,0 @@ export declare function parseUserAgent(ua: string): BrowserInfo | SearchBotDeviceInfo | BotInfo | null; |
16
index.js
@@ -52,2 +52,13 @@ "use strict"; | ||
exports.BotInfo = BotInfo; | ||
var ReactNativeInfo = /** @class */ (function () { | ||
function ReactNativeInfo() { | ||
this.type = 'react-native'; | ||
this.name = 'react-native'; | ||
this.version = null; | ||
this.os = null; | ||
} | ||
return ReactNativeInfo; | ||
}()); | ||
exports.ReactNativeInfo = ReactNativeInfo; | ||
; | ||
// tslint:disable-next-line:max-line-length | ||
@@ -124,2 +135,7 @@ var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/; | ||
} | ||
if (typeof document === 'undefined' && | ||
typeof navigator !== 'undefined' && | ||
navigator.product === 'ReactNative') { | ||
return new ReactNativeInfo(); | ||
} | ||
if (typeof navigator !== 'undefined') { | ||
@@ -126,0 +142,0 @@ return parseUserAgent(navigator.userAgent); |
{ | ||
"name": "detect-browser", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Unpack a browser type and version from the useragent string", | ||
@@ -42,3 +42,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/node": "^12.7.4", | ||
"@types/node": "^13.9.1", | ||
"embellish-readme": "^1.5.1", | ||
@@ -48,7 +48,7 @@ "npm-run-all": "^4.1.5", | ||
"rimraf": "^3.0.2", | ||
"semver": "^6.3.0", | ||
"semver": "^7.1.3", | ||
"tape": "^4.11.0", | ||
"tslint": "^5.11.0", | ||
"tslint": "^6.1.0", | ||
"typescript": "^3.6.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18005
5
267