express-useragent
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -7,3 +7,3 @@ /** | ||
* @package express-useragent | ||
* @version 0.1.5 | ||
* @version 0.1.6 | ||
* @copyright Copyright (c) 2009-2011 - All rights reserved. | ||
@@ -17,3 +17,3 @@ * @license MIT License | ||
var UserAgent = function() { | ||
this.version = '0.1.5'; | ||
this.version = '0.1.6'; | ||
this._Versions = { | ||
@@ -23,3 +23,3 @@ Firefox: /firefox\/([\d\w\.\-]+)/i, | ||
Chrome: /chrome\/([\d\w\.\-]+)/i, | ||
Chromium: /crios\/([\d\w\.\-]+)/i, | ||
Chromium: /(?:chromium|crios)\/([\d\w\.\-]+)/i, | ||
Safari: /version\/([\d\w\.\-]+)/i, | ||
@@ -43,3 +43,3 @@ Opera: /version\/([\d\w\.\-]+)/i, | ||
OmniWeb: /omniweb/i, | ||
Chromium: /(chromium)|(crios)/i, | ||
Chromium: /chromium|crios/i, | ||
Chrome: /chrome/i, | ||
@@ -46,0 +46,0 @@ Safari: /safari/i, |
{ | ||
"name": "express-useragent", | ||
"description": "ExpressJS/Connect/TrinteJS user-agent middleware exposing", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"homepage": "https://github.com/biggora/express-useragent/", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -7,6 +7,6 @@ /** | ||
exports['iPad 2'] = function(test) { | ||
exports['iPad 2'] = function (test) { | ||
var s = 'Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46' | ||
+' (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3'; | ||
+ ' (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3'; | ||
@@ -38,3 +38,3 @@ var a = ua.parse(s); | ||
exports['Linux Iceweasel'] = function(test) { | ||
exports['Linux Iceweasel'] = function (test) { | ||
@@ -69,3 +69,3 @@ var s = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16)' | ||
exports['Linux 64 Chrome'] = function(test) { | ||
exports['Linux 64 Chrome'] = function (test) { | ||
@@ -99,3 +99,3 @@ var s = 'User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36'; | ||
exports['Linux Firefox 11'] = function(test) { | ||
exports['Linux Firefox 11'] = function (test) { | ||
@@ -130,3 +130,3 @@ var s = 'Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0'; | ||
exports['Linux Chrome 17'] = function(test) { | ||
exports['Linux Chrome 17'] = function (test) { | ||
@@ -161,4 +161,35 @@ var s = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko)' | ||
exports['Linux Ephiphany 2.30'] = function(test) { | ||
exports['Linux Chromium 39'] = function (test) { | ||
var s = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)' | ||
+ ' Ubuntu Chromium/39.0.2171.65 Chrome/39.0.2171.65 Safari/537.36'; | ||
var a = ua.parse(s); | ||
test.ok(!a.isMobile, 'Mobile'); | ||
test.ok(!a.isiPad, 'iPad'); | ||
test.ok(!a.isiPod, 'iPod'); | ||
test.ok(!a.isiPhone, 'iPhone'); | ||
test.ok(!a.isAndroid, 'Android'); | ||
test.ok(!a.isBlackberry, 'Blackberry'); | ||
test.ok(!a.isOpera, 'Opera'); | ||
test.ok(!a.isIE, 'IE'); | ||
test.ok(!a.isSafari, 'Safari'); | ||
test.ok(!a.isFirefox, 'Firefox'); | ||
test.ok(!a.isWebkit, 'Webkit'); | ||
test.ok(a.isChrome, 'Chrome'); | ||
test.ok(!a.isKonqueror, 'Konqueror'); | ||
test.ok(a.isDesktop, 'Desktop'); | ||
test.ok(!a.isWindows, 'Windows'); | ||
test.ok(a.isLinux, 'Linux'); | ||
test.ok(!a.isMac, 'Mac'); | ||
test.ok(!a.isWindowsPhone, 'Windows Phone'); | ||
test.equal(a.Version, '39.0.2171.65'); | ||
test.ok(!a.isIECompatibilityMode); | ||
test.done(); | ||
}; | ||
exports['Linux Ephiphany 2.30'] = function (test) { | ||
var s = 'Mozilla/5.0 (X11; U; Linux i686; en-us) AppleWebKit/531.2+ (KHTML, like Gecko)' | ||
@@ -193,3 +224,3 @@ + ' Version/5.0 Safari/531.2+ Debian/squeeze (2.30.6-1) Epiphany/2.30.6'; | ||
exports['Windows 8 Chrome 28'] = function(test) { | ||
exports['Windows 8 Chrome 28'] = function (test) { | ||
@@ -224,3 +255,3 @@ var s = 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36'; | ||
exports['Windows 8.1 WinJs'] = function(test) { | ||
exports['Windows 8.1 WinJs'] = function (test) { | ||
@@ -256,3 +287,3 @@ var s = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; MSAppHost/2.0; rv:11.0) like Gecko'; | ||
exports['Windows 7 Firefox 23'] = function(test) { | ||
exports['Windows 7 Firefox 23'] = function (test) { | ||
@@ -287,3 +318,3 @@ var s = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'; | ||
exports['Windows XP IE 5.5'] = function(test) { | ||
exports['Windows XP IE 5.5'] = function (test) { | ||
@@ -317,3 +348,3 @@ var s = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)'; | ||
exports['Windows XP IE 6.0'] = function(test) { | ||
exports['Windows XP IE 6.0'] = function (test) { | ||
@@ -347,3 +378,3 @@ var s = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; | ||
exports['Windows XP IE 7.0'] = function(test) { | ||
exports['Windows XP IE 7.0'] = function (test) { | ||
@@ -377,3 +408,3 @@ var s = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'; | ||
exports['Windows XP Opera'] = function(test) { | ||
exports['Windows XP Opera'] = function (test) { | ||
@@ -407,6 +438,6 @@ var s = 'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.10.229 Version/11.62'; | ||
exports['Windows XP Safari'] = function(test) { | ||
exports['Windows XP Safari'] = function (test) { | ||
var s = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.51.22 (KHTML, like Gecko)' | ||
+ ' Version/5.1.1 Safari/534.51.22'; | ||
+ ' Version/5.1.1 Safari/534.51.22'; | ||
@@ -438,3 +469,3 @@ var a = ua.parse(s); | ||
exports['Windows XP Chrome'] = function(test) { | ||
exports['Windows XP Chrome'] = function (test) { | ||
@@ -469,6 +500,6 @@ var s = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19' | ||
exports['Windows Phone 8'] = function(test) { | ||
exports['Windows Phone 8'] = function (test) { | ||
var s = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; ' + | ||
'Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)'; | ||
'Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)'; | ||
@@ -500,3 +531,3 @@ var a = ua.parse(s); | ||
exports['OS X OmniWeb 622'] = function(test) { | ||
exports['OS X OmniWeb 622'] = function (test) { | ||
@@ -532,3 +563,3 @@ var s = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/528.16' | ||
exports['OS X Safari 530'] = function(test) { | ||
exports['OS X Safari 530'] = function (test) { | ||
@@ -563,3 +594,3 @@ var s = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us)' | ||
exports['OS X Chromium'] = function(test) { | ||
exports['OS X Chromium'] = function (test) { | ||
@@ -581,3 +612,3 @@ var s = 'Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/32.0.1700.20 Mobile/11B554a Safari/9537.53'; | ||
test.ok(!a.isWebkit, 'Webkit'); | ||
test.ok(a.isChrome, 'Chrome'); | ||
test.ok(a.isChrome, 'Chromium'); | ||
test.ok(!a.isKonqueror, 'Konqueror'); | ||
@@ -598,3 +629,3 @@ test.ok(!a.isDesktop, 'Desktop'); | ||
exports['Android Samsung'] = function(test) { | ||
exports['Android Samsung'] = function (test) { | ||
@@ -632,3 +663,3 @@ var s = 'Mozilla/5.0 (Linux; U; Android 2.2; en-ca; SGH-T959D Build/FROYO) AppleWebKit/533.1' | ||
exports['Android Xoom'] = function(test) { | ||
exports['Android Xoom'] = function (test) { | ||
@@ -666,3 +697,3 @@ var s = 'Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13' | ||
exports['iPhone 4'] = function(test) { | ||
exports['iPhone 4'] = function (test) { | ||
@@ -700,3 +731,3 @@ var s = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9' | ||
exports['Bada OS browser'] = function(test) { | ||
exports['Bada OS browser'] = function (test) { | ||
@@ -732,3 +763,3 @@ var s = 'Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-S8500/S8500NEJE5; U; Bada/1.0; fr-fr) AppleWebKit/533.1' | ||
exports['America Online Browser'] = function(test) { | ||
exports['America Online Browser'] = function (test) { | ||
@@ -763,3 +794,3 @@ var s = 'Mozilla/4.0 (compatible; MSIE 7.0;' | ||
exports['Windows 7 IE 10.6'] = function(test) { | ||
exports['Windows 7 IE 10.6'] = function (test) { | ||
@@ -793,3 +824,3 @@ var s = 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0'; | ||
exports['Windows 7 IE 11.0'] = function(test) { | ||
exports['Windows 7 IE 11.0'] = function (test) { | ||
@@ -823,31 +854,31 @@ var s = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'; | ||
exports['Windows 8.1 IE 11 Touch'] = function(test) { | ||
var s = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; Touch; rv:11.0) like Gecko' | ||
exports['Windows 8.1 IE 11 Touch'] = function (test) { | ||
var s = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; Touch; rv:11.0) like Gecko' | ||
var a = ua.parse(s); | ||
var a = ua.parse(s); | ||
test.ok(!a.isMobile, 'Mobile'); | ||
test.ok(!a.isiPad, 'iPad'); | ||
test.ok(!a.isiPod, 'iPod'); | ||
test.ok(!a.isiPhone, 'iPhone'); | ||
test.ok(!a.isAndroid, 'Android'); | ||
test.ok(!a.isBlackberry, 'Blackberry'); | ||
test.ok(!a.isOpera, 'Opera'); | ||
test.ok(a.isIE, 'IE'); | ||
test.ok(!a.isSafari, 'Safari'); | ||
test.ok(!a.isFirefox, 'Firefox'); | ||
test.ok(!a.isWebkit, 'Webkit'); | ||
test.ok(!a.isChrome, 'Chrome'); | ||
test.ok(!a.isKonqueror, 'Konqueror'); | ||
test.ok(a.isDesktop, 'Desktop'); | ||
test.ok(a.isWindows, 'Windows'); | ||
test.ok(!a.isLinux, 'Linux'); | ||
test.ok(!a.isMac, 'Mac'); | ||
test.ok(!a.isWindowsPhone, 'Windows Phone'); | ||
test.equal(a.Version, '11.0'); | ||
test.ok(!a.isMobile, 'Mobile'); | ||
test.ok(!a.isiPad, 'iPad'); | ||
test.ok(!a.isiPod, 'iPod'); | ||
test.ok(!a.isiPhone, 'iPhone'); | ||
test.ok(!a.isAndroid, 'Android'); | ||
test.ok(!a.isBlackberry, 'Blackberry'); | ||
test.ok(!a.isOpera, 'Opera'); | ||
test.ok(a.isIE, 'IE'); | ||
test.ok(!a.isSafari, 'Safari'); | ||
test.ok(!a.isFirefox, 'Firefox'); | ||
test.ok(!a.isWebkit, 'Webkit'); | ||
test.ok(!a.isChrome, 'Chrome'); | ||
test.ok(!a.isKonqueror, 'Konqueror'); | ||
test.ok(a.isDesktop, 'Desktop'); | ||
test.ok(a.isWindows, 'Windows'); | ||
test.ok(!a.isLinux, 'Linux'); | ||
test.ok(!a.isMac, 'Mac'); | ||
test.ok(!a.isWindowsPhone, 'Windows Phone'); | ||
test.equal(a.Version, '11.0'); | ||
test.done(); | ||
test.done(); | ||
}; | ||
exports['Windows XP IE 8.0'] = function(test) { | ||
exports['Windows XP IE 8.0'] = function (test) { | ||
@@ -881,3 +912,3 @@ var s = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)'; | ||
exports['Windows XP IE 8.0 - Compatibility mode'] = function(test) { | ||
exports['Windows XP IE 8.0 - Compatibility mode'] = function (test) { | ||
@@ -912,3 +943,3 @@ var s = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)'; | ||
exports['Windows XP IE 10.0'] = function(test) { | ||
exports['Windows XP IE 10.0'] = function (test) { | ||
@@ -943,3 +974,3 @@ var s = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2)'; | ||
exports['Windows XP IE 10.0 - Compatibility mode'] = function(test) { | ||
exports['Windows XP IE 10.0 - Compatibility mode'] = function (test) { | ||
@@ -974,3 +1005,3 @@ var s = 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0)'; | ||
exports['Windows XP IE 7.0 - Compatibility mode (invalid mode)'] = function(test) { | ||
exports['Windows XP IE 7.0 - Compatibility mode (invalid mode)'] = function (test) { | ||
@@ -1005,3 +1036,3 @@ var s = 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/1.0)'; | ||
exports['Windows XP IE 9.0 - Compatibility mode'] = function(test) { | ||
exports['Windows XP IE 9.0 - Compatibility mode'] = function (test) { | ||
@@ -1008,0 +1039,0 @@ var s = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)'; |
74643
1756