browser-info
Advanced tools
Comparing version 1.1.0 to 1.1.1
48
index.js
@@ -5,2 +5,25 @@ /* globals navigator*/ | ||
function getOS(userAgent){ | ||
if (userAgent.indexOf('Windows Phone') !== -1) { | ||
return 'Windows Phone'; | ||
} | ||
if (userAgent.indexOf('Win') !== -1) { | ||
return 'Windows'; | ||
} | ||
if (userAgent.indexOf('Android') !== -1) { | ||
return 'Android'; | ||
} | ||
if (userAgent.indexOf('Linux') !== -1) { | ||
return 'Linux'; | ||
} | ||
if (userAgent.indexOf('X11') !== -1) { | ||
return 'UNIX'; | ||
} | ||
if (/iPad|iPhone|iPod/.test(userAgent)) { | ||
return 'iOS'; | ||
} | ||
if (userAgent.indexOf('Mac') !== -1) { | ||
return 'OS X'; | ||
} | ||
} | ||
@@ -11,28 +34,5 @@ function info(userAgent){ | ||
var os = getOS(ua); | ||
var match = ua.match(/(opera|coast|chrome|safari|firefox|edge|trident(?=\/))\/?\s*?(\S+)/i) || []; | ||
var os = (function (match){ | ||
if (ua.indexOf('Windows Phone') !== -1) { | ||
return 'Windows Phone'; | ||
} | ||
if (ua.indexOf('Win') !== -1) { | ||
return 'Windows'; | ||
} | ||
if (ua.indexOf('Android') !== -1) { | ||
return 'Android'; | ||
} | ||
if (ua.indexOf('Linux') !== -1) { | ||
return 'Linux'; | ||
} | ||
if (ua.indexOf('X11') !== -1) { | ||
return 'UNIX'; | ||
} | ||
if (/iPad|iPhone|iPod/.test(ua)) { | ||
return 'iOS'; | ||
} | ||
if (ua.indexOf('Mac') !== -1) { | ||
return 'OS X'; | ||
} | ||
})(match); | ||
tem = ua.match(/\bIEMobile\/(\S+[0-9])/); | ||
@@ -39,0 +39,0 @@ if (tem !== null) { |
{ | ||
"name": "browser-info", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Get browser info", | ||
@@ -5,0 +5,0 @@ "author": "Steve Lacy <me@slacy.me> (http://slacy.me)", |
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
9001
189