Comparing version 3.0.1 to 3.1.0
@@ -52,3 +52,3 @@ /** | ||
[ 'safari', _webkit ], | ||
[ _ff, 'Moz' ], | ||
[ _ff, 'moz' ], | ||
[ 'opera', 'O' ], | ||
@@ -97,2 +97,3 @@ [ 'msie', 'ms', 'ie' ], | ||
[ 'aft[bsm]', _firetv ], | ||
[ 'mozilla\\/5.0 \\(compatible; .+http:\\/\\/', 'bot' ], | ||
[ node, 'server' ] | ||
@@ -99,0 +100,0 @@ ) |
{ | ||
"name": "vigour-ua", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "lightweight ua parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,2 +14,19 @@ 'use strict' | ||
test('browsers - firefox', function (t) { | ||
check({ | ||
list: useragents.firefox, | ||
browser: 'firefox', | ||
prefix: 'moz' | ||
}, t) | ||
t.end() | ||
}) | ||
test('browsers - ie', function (t) { | ||
check({ | ||
list: useragents.ie, | ||
browser: 'ie' | ||
}, t) | ||
t.end() | ||
}) | ||
function check (params, t) { | ||
@@ -19,4 +36,5 @@ var result | ||
result = ua(params.list[i]) | ||
if (params.prefix) t.equals(result.prefix, params.prefix, 'equals prefix') | ||
t.equals(result.browser, params.browser, 'equals browser') | ||
} | ||
} |
@@ -96,2 +96,12 @@ 'use strict' | ||
test('devices - bots', function (t) { | ||
check({ | ||
list: useragents.bots, | ||
device: 'bot' | ||
}, t) | ||
t.end() | ||
}) | ||
function check (params, t) { | ||
@@ -102,4 +112,4 @@ var result | ||
t.equals(result.device, params.device, 'equals device') | ||
t.equals(result.platform, params.platform, 'equals platform') | ||
if (params.platform) { t.equals(result.platform, params.platform, 'equals platform') } | ||
} | ||
} |
@@ -46,2 +46,3 @@ exports.samsungSmartTv = [ | ||
exports.androidPhone = [ | ||
'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0', | ||
// htc | ||
@@ -64,2 +65,3 @@ 'Mozilla/5.0 (Linux; U; Android 2.1-update1; de-de; HTC Desire 1.19.161.5 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17', | ||
exports.androidTablet = [ | ||
'Mozilla/5.0 (Android 4.4; Tablet; rv:41.0) Gecko/41.0 Firefox/41.0', | ||
'Mozilla/5.0 (Linux; U; Android 3.2.1; ru-ru; HTC Flyer P510e Build/HTK75C) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13', | ||
@@ -92,1 +94,21 @@ 'Mozilla/5.0 (Linux; Android 5.0; Nexus 9 Build/LRX21R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Mobile Crosswalk/7.36.154.13 Safari/537.36', | ||
] | ||
exports.firefox = [ | ||
'Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0', | ||
'Mozilla/5.0 (Macintosh; PPC Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0', | ||
'Mozilla/5.0 (Android; Mobile; rv:40.0) Gecko/40.0 Firefox/40.0', | ||
'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0' | ||
] | ||
exports.ie = [ | ||
'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko', | ||
'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', | ||
'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko', | ||
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Trident/5.0)' | ||
] | ||
exports.bots = [ | ||
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', | ||
'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)', | ||
'Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)' | ||
] |
96121
454