ua-parser-js
Advanced tools
Comparing version 0.4.15 to 0.5.1
{ | ||
"title": "UA-Parser.JS", | ||
"name": "ua-parser-js", | ||
"version": "0.4.15", | ||
"version": "0.5.1", | ||
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)", | ||
@@ -6,0 +6,0 @@ "description": "Lightweight JavaScript-based user-agent string parser", |
@@ -5,2 +5,4 @@ # UA-Parser.JS | ||
[![Build Status](https://travis-ci.org/faisalman/ua-parser-js.png)](https://travis-ci.org/faisalman/ua-parser-js) | ||
* Author : Faisalman <<fyzlman@gmail.com>> | ||
@@ -11,4 +13,2 @@ * Home : http://faisalman.github.com/ua-parser-js | ||
[![Build Status](https://travis-ci.org/faisalman/ua-parser-js.png)](https://travis-ci.org/faisalman/ua-parser-js) | ||
## Features | ||
@@ -18,2 +18,4 @@ | ||
![It's over 9000](https://pbs.twimg.com/media/A9LpEG6CIAA5VrT.jpg) | ||
## Methods | ||
@@ -20,0 +22,0 @@ |
910
test.js
@@ -11,3 +11,4 @@ var assert = require('assert'); | ||
name : 'Arora', | ||
version : '0.2' | ||
version : '0.2', | ||
major : '0' | ||
} | ||
@@ -21,3 +22,4 @@ }, | ||
name : 'Avant Browser', | ||
version : undefined | ||
version : undefined, | ||
major : undefined | ||
} | ||
@@ -31,3 +33,4 @@ }, | ||
name : 'baidubrowser', | ||
version : '1.x' | ||
version : '1.x', | ||
major : '1' | ||
} | ||
@@ -41,3 +44,4 @@ }, | ||
name : 'Bolt', | ||
version : '0.862' | ||
version : '0.862', | ||
major : '0' | ||
} | ||
@@ -51,3 +55,4 @@ }, | ||
name : 'Camino', | ||
version : '2.0.9' | ||
version : '2.0.9', | ||
major : '2' | ||
} | ||
@@ -61,3 +66,4 @@ }, | ||
name : 'Chimera', | ||
version : '0.6' | ||
version : '0.6', | ||
major : '0' | ||
} | ||
@@ -71,3 +77,4 @@ }, | ||
name : 'Chrome', | ||
version : '20.0.1090.0' | ||
version : '20.0.1090.0', | ||
major : '20' | ||
} | ||
@@ -81,3 +88,4 @@ }, | ||
name : 'Chrome', | ||
version : '19.0.1084.60' | ||
version : '19.0.1084.60', | ||
major : '19' | ||
} | ||
@@ -91,3 +99,4 @@ }, | ||
name : 'Chromium', | ||
version : '16.0.912.21' | ||
version : '16.0.912.21', | ||
major : '16' | ||
} | ||
@@ -101,3 +110,4 @@ }, | ||
name : 'Chrome', | ||
version : '16.0.912.75' | ||
version : '16.0.912.75', | ||
major : '16' | ||
} | ||
@@ -111,3 +121,4 @@ }, | ||
name : 'Dillo', | ||
version : '2.2' | ||
version : '2.2', | ||
major : '2' | ||
} | ||
@@ -121,3 +132,4 @@ }, | ||
name : 'Dolphin', | ||
version : '2.0' | ||
version : '2.0', | ||
major : '2' | ||
} | ||
@@ -131,3 +143,4 @@ }, | ||
name : 'Doris', | ||
version : '1.15' | ||
version : '1.15', | ||
major : '1' | ||
} | ||
@@ -141,3 +154,4 @@ }, | ||
name : 'Epiphany', | ||
version : '1.2.6' | ||
version : '1.2.6', | ||
major : '1' | ||
} | ||
@@ -151,3 +165,4 @@ }, | ||
name : 'Firebird', | ||
version : '0.7' | ||
version : '0.7', | ||
major : '0' | ||
} | ||
@@ -161,3 +176,4 @@ }, | ||
name : 'Firefox', | ||
version : '15.0a2' | ||
version : '15.0a2', | ||
major : '15' | ||
} | ||
@@ -171,3 +187,4 @@ }, | ||
name : 'Fennec', | ||
version : '1.0a1' | ||
version : '1.0a1', | ||
major : '1' | ||
} | ||
@@ -181,3 +198,4 @@ }, | ||
name : 'Flock', | ||
version : '2.0' | ||
version : '2.0', | ||
major : '2' | ||
} | ||
@@ -191,3 +209,4 @@ }, | ||
name : 'GoBrowser', | ||
version : '1.6.91' | ||
version : '1.6.91', | ||
major : '1' | ||
} | ||
@@ -201,3 +220,4 @@ }, | ||
name : 'Iceape', | ||
version : '2.0.14' | ||
version : '2.0.14', | ||
major : '2' | ||
} | ||
@@ -211,3 +231,4 @@ }, | ||
name : 'IceCat', | ||
version : '3.0.3-g1' | ||
version : '3.0.3-g1', | ||
major : '3' | ||
} | ||
@@ -221,3 +242,4 @@ }, | ||
name : 'Iceweasel', | ||
version : '3.0.6' | ||
version : '3.0.6', | ||
major : '3' | ||
} | ||
@@ -231,3 +253,4 @@ }, | ||
name : 'iCab', | ||
version : '2.9.5' | ||
version : '2.9.5', | ||
major : '2' | ||
} | ||
@@ -241,3 +264,4 @@ }, | ||
name : 'IEMobile', | ||
version : '7.11' | ||
version : '7.11', | ||
major : '7' | ||
} | ||
@@ -251,3 +275,4 @@ }, | ||
name : 'K-Meleon', | ||
version : '0.8.2' | ||
version : '0.8.2', | ||
major : '0' | ||
} | ||
@@ -261,3 +286,4 @@ }, | ||
name : 'Kindle', | ||
version : '2.5' | ||
version : '2.5', | ||
major : '2' | ||
} | ||
@@ -271,3 +297,4 @@ }, | ||
name : 'Konqueror', | ||
version : '3.5' | ||
version : '3.5', | ||
major : '3' | ||
} | ||
@@ -281,3 +308,4 @@ }, | ||
name : 'Lunascape', | ||
version : '5.1.4.5' | ||
version : '5.1.4.5', | ||
major : '5' | ||
} | ||
@@ -291,3 +319,4 @@ }, | ||
name : 'Lynx', | ||
version : '2.8.5dev.16' | ||
version : '2.8.5dev.16', | ||
major : '2' | ||
} | ||
@@ -301,3 +330,4 @@ }, | ||
name : 'Maemo Browser', | ||
version : '1.7.4.8' | ||
version : '1.7.4.8', | ||
major : '1' | ||
} | ||
@@ -311,3 +341,4 @@ }, | ||
name : 'Maxthon', | ||
version : undefined | ||
version : undefined, | ||
major : undefined | ||
} | ||
@@ -321,3 +352,4 @@ }, | ||
name : 'Midori', | ||
version : '0.2.2' | ||
version : '0.2.2', | ||
major : '0' | ||
} | ||
@@ -331,3 +363,4 @@ }, | ||
name : 'Minimo', | ||
version : '0.020' | ||
version : '0.020', | ||
major : '0' | ||
} | ||
@@ -341,3 +374,4 @@ }, | ||
name : 'Mobile Safari', | ||
version : '4.0.5' | ||
version : '4.0.5', | ||
major : '4' | ||
} | ||
@@ -351,3 +385,4 @@ }, | ||
name : 'Mosaic', | ||
version : '2.6' | ||
version : '2.6', | ||
major : '2' | ||
} | ||
@@ -361,3 +396,4 @@ }, | ||
name : 'Mozilla', | ||
version : '5.0' | ||
version : '5.0', | ||
major : '5' | ||
} | ||
@@ -371,3 +407,4 @@ }, | ||
name : 'IE', | ||
version : '5.0b1' | ||
version : '5.0b1', | ||
major : '5' | ||
} | ||
@@ -381,3 +418,4 @@ }, | ||
name : 'NetFront', | ||
version : '3.0' | ||
version : '3.0', | ||
major : '3' | ||
} | ||
@@ -391,3 +429,4 @@ }, | ||
name : 'Netscape', | ||
version : '9.0' | ||
version : '9.0', | ||
major : '9' | ||
} | ||
@@ -401,3 +440,4 @@ }, | ||
name : 'Netscape', | ||
version : '8.0.1' | ||
version : '8.0.1', | ||
major : '8' | ||
} | ||
@@ -411,3 +451,4 @@ }, | ||
name : 'NokiaBrowser', | ||
version : '7.3.1.37' | ||
version : '7.3.1.37', | ||
major : '7' | ||
} | ||
@@ -421,3 +462,4 @@ }, | ||
name : 'OmniWeb', | ||
version : '558.48' | ||
version : '558.48', | ||
major : '558' | ||
} | ||
@@ -431,3 +473,4 @@ }, | ||
name : 'Opera', | ||
version : '10.10' | ||
version : '10.10', | ||
major : '10' | ||
} | ||
@@ -441,3 +484,4 @@ }, | ||
name : 'Opera', | ||
version : '6.01' | ||
version : '6.01', | ||
major : '6' | ||
} | ||
@@ -451,3 +495,4 @@ }, | ||
name : 'Opera', | ||
version : '8.5' | ||
version : '8.5', | ||
major : '8' | ||
} | ||
@@ -461,3 +506,4 @@ }, | ||
name : 'Opera Mobi', | ||
version : '11.50' | ||
version : '11.50', | ||
major : '11' | ||
} | ||
@@ -471,6 +517,17 @@ }, | ||
name : 'Opera Mini', | ||
version : '5.1.21214' | ||
version : '5.1.21214', | ||
major : '5' | ||
} | ||
}, | ||
{ | ||
desc : 'Opera Tablet', | ||
ua : 'Opera/9.80 (Windows NT 6.1; Opera Tablet/15165; U; en) Presto/2.8.149 Version/11.1', | ||
expect : | ||
{ | ||
name : 'Opera Tablet', | ||
version : '11.1', | ||
major : '11' | ||
} | ||
}, | ||
{ | ||
desc : 'Phoenix', | ||
@@ -481,3 +538,4 @@ ua : 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021029 Phoenix/0.4', | ||
name : 'Phoenix', | ||
version : '0.4' | ||
version : '0.4', | ||
major : '0' | ||
} | ||
@@ -491,3 +549,4 @@ }, | ||
name : 'Polaris', | ||
version : '6.0' | ||
version : '6.0', | ||
major : '6' | ||
} | ||
@@ -501,6 +560,17 @@ }, | ||
name : 'RockMelt', | ||
version : '0.8.36.78' | ||
version : '0.8.36.78', | ||
major : '0' | ||
} | ||
}, | ||
{ | ||
desc : 'Safari', | ||
ua : 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8', | ||
expect : | ||
{ | ||
name : 'Safari', | ||
version : '5.0.1', | ||
major : '5' | ||
} | ||
}, | ||
{ | ||
desc : 'Safari < 3.0', | ||
@@ -511,3 +581,4 @@ ua : 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3', | ||
name : 'Safari', | ||
version : '2.0.4' | ||
version : '2.0.4', | ||
major : '2' | ||
} | ||
@@ -521,3 +592,4 @@ }, | ||
name : 'SeaMonkey', | ||
version : '2.0b1pre' | ||
version : '2.0b1pre', | ||
major : '2' | ||
} | ||
@@ -531,3 +603,4 @@ }, | ||
name : 'Silk', | ||
version : '1.1.0-84' | ||
version : '1.1.0-84', | ||
major : '1' | ||
} | ||
@@ -541,3 +614,4 @@ }, | ||
name : 'Skyfire', | ||
version : '2.0' | ||
version : '2.0', | ||
major : '2' | ||
} | ||
@@ -551,3 +625,4 @@ }, | ||
name : 'SlimBrowser', | ||
version : undefined | ||
version : undefined, | ||
major : undefined | ||
} | ||
@@ -561,3 +636,4 @@ }, | ||
name : 'Swiftfox', | ||
version : undefined | ||
version : undefined, | ||
major : undefined | ||
} | ||
@@ -571,3 +647,4 @@ }, | ||
name : 'Tizen Browser', | ||
version : '1.0' | ||
version : '1.0', | ||
major : '1' | ||
} | ||
@@ -581,3 +658,4 @@ }, | ||
name : 'UCBrowser', | ||
version : '8.2.1.144' | ||
version : '8.2.1.144', | ||
major : '8' | ||
} | ||
@@ -591,3 +669,4 @@ }, | ||
name : 'UC Browser', | ||
version : '8.4.0.159' | ||
version : '8.4.0.159', | ||
major : '8' | ||
} | ||
@@ -601,6 +680,633 @@ }, | ||
name : 'Yandex', | ||
version : '1.0.1084.5402' | ||
version : '1.0.1084.5402', | ||
major : '1' | ||
} | ||
} | ||
]; | ||
}]; | ||
var engines = [ | ||
{ | ||
desc : 'Gecko', | ||
ua : 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre', | ||
expect : | ||
{ | ||
name : 'Gecko', | ||
version : '2.0b9pre' | ||
} | ||
}, | ||
{ | ||
desc : 'KHTML', | ||
ua : 'Mozilla/5.0 (compatible; Konqueror/4.5; FreeBSD) KHTML/4.5.4 (like Gecko)', | ||
expect : | ||
{ | ||
name : 'KHTML', | ||
version : '4.5.4' | ||
} | ||
}, | ||
{ | ||
desc : 'NetFront', | ||
ua : 'Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0', | ||
expect : | ||
{ | ||
name : 'NetFront', | ||
version : '3.0' | ||
} | ||
}, | ||
{ | ||
desc : 'Presto', | ||
ua : 'Opera/9.80 (Windows NT 6.1; Opera Tablet/15165; U; en) Presto/2.8.149 Version/11.1', | ||
expect : | ||
{ | ||
name : 'Presto', | ||
version : '2.8.149' | ||
} | ||
}, | ||
{ | ||
desc : 'Tasman', | ||
ua : 'Mozilla/4.0 (compatible; MSIE 6.0; PPC Mac OS X 10.4.7; Tasman 1.0)', | ||
expect : | ||
{ | ||
name : 'Tasman', | ||
version : '1.0' | ||
} | ||
}, | ||
{ | ||
desc : 'Trident', | ||
ua : 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)', | ||
expect : | ||
{ | ||
name : 'Trident', | ||
version : '6.0' | ||
} | ||
}, | ||
{ | ||
desc : 'WebKit', | ||
ua : 'Mozilla/5.0 (Windows; U; Windows NT 6.1; sv-SE) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4', | ||
expect : | ||
{ | ||
name : 'WebKit', | ||
version : '533.19.4' | ||
} | ||
}]; | ||
var os = [ | ||
{ | ||
desc : 'Windows 95', | ||
ua : 'Mozilla/1.22 (compatible; MSIE 2.0; Windows 95)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : '95' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows 98', | ||
ua : 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : '98' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows ME', | ||
ua : 'Mozilla/5.0 (Windows; U; Win 9x 4.90) Gecko/20020502 CS 2000 7.0/7.0', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : 'ME' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows 2000', | ||
ua : 'Mozilla/3.0 (compatible; MSIE 3.0; Windows NT 5.0)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : '2000' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows XP', | ||
ua : 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 5.2)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : 'XP' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows Vista', | ||
ua : 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; fr-FR)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : 'Vista' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows 7', | ||
ua : 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : '7' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows 8', | ||
ua : 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Win64; x64; Trident/6.0; .NET4.0E; .NET4.0C)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : '8' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows RT', | ||
ua : 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : 'RT' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows CE', | ||
ua : 'Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)', | ||
expect : | ||
{ | ||
name : 'Windows', | ||
version : 'CE' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows Mobile', | ||
ua : 'Mozilla/5.0 (ZTE-E_N72/N72V1.0.0B02;U;Windows Mobile/6.1;Profile/MIDP-2.0 Configuration/CLDC-1.1;320*240;CTC/2.0) IE/6.0 (compatible; MSIE 4.01; Windows CE; PPC)/UC Browser7.7.1.88', | ||
expect : | ||
{ | ||
name : 'Windows Mobile', | ||
version : '6.1' | ||
} | ||
}, | ||
{ | ||
desc : 'Windows Phone OS', | ||
ua : 'Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; DELL; Venue Pro)', | ||
expect : | ||
{ | ||
name : 'Windows Phone OS', | ||
version : '7.0' | ||
} | ||
}, | ||
{ | ||
desc : 'BlackBerry', | ||
ua : 'BlackBerry9300/5.0.0.912 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/378', | ||
expect : | ||
{ | ||
name : 'BlackBerry', | ||
version : '5.0.0.912' | ||
} | ||
}, | ||
{ | ||
desc : 'BlackBerry 10', | ||
ua : 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.3+ (KHTML, like Gecko) Version/10.0.9.386 Mobile Safari/537.3+', | ||
expect : | ||
{ | ||
name : 'BlackBerry', | ||
version : '10' | ||
} | ||
}, | ||
{ | ||
desc : 'Tizen', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Android', | ||
ua : 'Mozilla/5.0 (Linux; U; Android 2.2.2; en-us; VM670 Build/FRG83G) AppleWebKit/533.1 (KHTML, like Gecko)', | ||
expect : | ||
{ | ||
name : 'Android', | ||
version : '2.2.2' | ||
} | ||
}, | ||
{ | ||
desc : 'WebOS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Palm OS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'QNX', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Bada', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'RIM Tablet OS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'MeeGo', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Symbian', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Nintendo', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'PlayStation', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Mint', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Joli', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Ubuntu', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Debian', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'OpenSUSE', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Gentoo', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Arch', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Slackware', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Fedora', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Mandriva', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'CentOS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'PCLinuxOS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'RedHat', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Zenwalk', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Hurd', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Linux', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'GNU', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Chromium OS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Solaris', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'FreeBSD', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'OpenBSD', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'NetBSD', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'DragonFly', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'iOS with Chrome', | ||
ua : 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3', | ||
expect : | ||
{ | ||
name : 'iOS', | ||
version : '5.1.1' | ||
} | ||
}, | ||
{ | ||
desc : 'iOS with Opera Mini', | ||
ua : 'Opera/9.80 (iPhone; Opera Mini/7.1.32694/27.1407; U; en) Presto/2.8.119 Version/11.10', | ||
expect : | ||
{ | ||
name : 'iOS', | ||
version : undefined | ||
} | ||
}, | ||
{ | ||
desc : 'Mac OS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Haiku', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'AIX', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Plan9', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'Minix', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'BeOS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'OS/2', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'AmigaOS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'MorphOS', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : 'UNIX', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}, | ||
{ | ||
desc : '', | ||
ua : '', | ||
expect : | ||
{ | ||
name : '', | ||
version : '' | ||
} | ||
}]; | ||
var devices = [ | ||
{ | ||
desc : 'HTC Evo Shift 4G', | ||
ua : 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0', | ||
expect : | ||
{ | ||
vendor : 'HTC', | ||
model : 'Evo Shift 4G', | ||
type : 'mobile' | ||
} | ||
}]; | ||
@@ -624,2 +1330,6 @@ describe('getBrowser', function () { | ||
}); | ||
it('should return browser major version: ' + expect.major, function () { | ||
assert.equal(result.major, expect.major); | ||
}); | ||
}); | ||
@@ -629,1 +1339,77 @@ }); | ||
}); | ||
describe('getEngine', function () { | ||
for (var i in engines) { | ||
describe('[' + engines[i].desc + ']', function () { | ||
describe('"' + engines[i].ua + '"', function () { | ||
var expect = engines[i].expect; | ||
var result = parser.setUA(engines[i].ua).getEngine(); | ||
it('should return engine name: ' + expect.name, function () { | ||
assert.equal(result.name, expect.name); | ||
}); | ||
it('should return engine version: ' + expect.version, function () { | ||
assert.equal(result.version, expect.version); | ||
}); | ||
}); | ||
}); | ||
} | ||
}); | ||
describe('getOS', function () { | ||
for (var i in os) { | ||
if (os[i].ua) { | ||
describe('[' + os[i].desc + ']', function () { | ||
describe('"' + os[i].ua + '"', function () { | ||
var expect = os[i].expect; | ||
var result = parser.setUA(os[i].ua).getOS(); | ||
it('should return OS name: ' + expect.name, function () { | ||
assert.equal(result.name, expect.name); | ||
}); | ||
it('should return OS version: ' + expect.version, function () { | ||
assert.equal(result.version, expect.version); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
}); | ||
describe('getDevice', function () { | ||
for (var i in devices) { | ||
if (devices[i].ua) { | ||
describe('[' + devices[i].desc + ']', function () { | ||
describe('"' + devices[i].ua + '"', function () { | ||
var expect = devices[i].expect; | ||
var result = parser.setUA(devices[i].ua).getDevice(); | ||
it('should return device vendor: ' + expect.vendor, function () { | ||
assert.equal(result.vendor, expect.vendor); | ||
}); | ||
it('should return device model: ' + expect.model, function () { | ||
assert.equal(result.model, expect.model); | ||
}); | ||
it('should return device type: ' + expect.type, function () { | ||
assert.equal(result.type, expect.type); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
}); |
173
ua-parser.js
@@ -1,2 +0,2 @@ | ||
// UA-Parser.JS v0.4.15 | ||
// UA-Parser.JS v0.5.1 | ||
// Lightweight JavaScript-based User-Agent string parser | ||
@@ -11,2 +11,16 @@ // https://github.com/faisalman/ua-parser-js | ||
'use strict'; | ||
var EMPTY = '', | ||
FUNC = 'function', | ||
UNDEF = 'undefined', | ||
OBJ = 'object', | ||
MAJOR = 'major', | ||
MODEL = 'model', | ||
NAME = 'name', | ||
TYPE = 'type', | ||
VENDOR = 'vendor', | ||
VERSION = 'version', | ||
CONSOLE = 'console', | ||
MOBILE = 'mobile', | ||
TABLET = 'tablet'; | ||
@@ -26,6 +40,6 @@ var mapper = { | ||
// construct object barebones | ||
if (typeof result === 'undefined') { | ||
if (typeof result === UNDEF) { | ||
result = {}; | ||
for (k = 0; k < props.length; k++) { | ||
if (typeof props[k] === 'object') { | ||
if (typeof props[k] === OBJ) { | ||
result[props[k][0]] = undefined; | ||
@@ -36,3 +50,3 @@ } else { | ||
} | ||
if (this.getUA().toString() === '') { | ||
if (this.getUA().toString() === EMPTY) { | ||
return result; | ||
@@ -48,6 +62,6 @@ } | ||
m = l[k + 1]; | ||
if (typeof props[k] === 'object' && props[k].length === 2) { | ||
if (typeof props[k] === OBJ && props[k].length === 2) { | ||
result[props[k][0]] = props[k][1]; | ||
} else if (typeof props[k] === 'object' && props[k].length === 3) { | ||
if (typeof props[k][1] === 'function' && !(props[k][1].exec && props[k][1].test)) { | ||
} else if (typeof props[k] === OBJ && props[k].length === 3) { | ||
if (typeof props[k][1] === FUNC && !(props[k][1].exec && props[k][1].test)) { | ||
result[props[k][0]] = m ? props[k][1].call(this, m, props[k][2]) : undefined; | ||
@@ -74,10 +88,10 @@ } else { | ||
if (map.hasOwnProperty(i)) { | ||
if (typeof map[i] === 'object' && map[i].length > 0) { | ||
if (typeof map[i] === OBJ && map[i].length > 0) { | ||
for (var j = 0; j < map[i].length; j++) { | ||
if (str.toLowerCase().indexOf(map[i][j].toLowerCase()) !== -1) { | ||
return (i.toString() === 'undefined') ? undefined : i; | ||
return (i.toString() === UNDEF) ? undefined : i; | ||
} | ||
} | ||
} else if (str.toLowerCase().indexOf(map[i].toLowerCase()) !== -1) { | ||
return (i.toString() === 'undefined') ? undefined : i; | ||
return (i.toString() === UNDEF) ? undefined : i; | ||
} | ||
@@ -91,4 +105,5 @@ } | ||
var maps = { | ||
browser : { | ||
oldsafari : { | ||
browser : { | ||
oldsafari : { | ||
major : { | ||
@@ -98,3 +113,3 @@ '1' : ['/85', '/125', '/312'], | ||
'undefined' : '/' | ||
}, | ||
}, | ||
version : { | ||
@@ -112,4 +127,13 @@ '1.0' : '/85', | ||
}, | ||
os : { | ||
windows : { | ||
device : { | ||
htc : { | ||
model : { | ||
'Evo Shift 4G' : '7373KT' | ||
} | ||
} | ||
}, | ||
os : { | ||
windows : { | ||
version : { | ||
@@ -136,3 +160,3 @@ 'ME' : '4.90', | ||
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini | ||
/(opera\smobi).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobile | ||
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet | ||
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80 | ||
@@ -154,33 +178,33 @@ /(opera)[\/\s]+((\d+)?[\w\.]+)/i, // Opera < 9.80 | ||
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt | ||
], ['name', 'version', 'major'], [ | ||
], [NAME, VERSION, MAJOR], [ | ||
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex | ||
], [['name', 'Yandex'], 'version', 'major'], [ | ||
], [[NAME, 'Yandex'], VERSION, MAJOR], [ | ||
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i | ||
// Chrome/OmniWeb/Arora/Tizen/Nokia | ||
], ['name', 'version', 'major'], [ | ||
], [NAME, VERSION, MAJOR], [ | ||
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin | ||
], [['name', 'Dolphin'], 'version', 'major'], [ | ||
], [[NAME, 'Dolphin'], VERSION, MAJOR], [ | ||
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS | ||
], [['name', 'Chrome'], 'version', 'major'], [ | ||
], [[NAME, 'Chrome'], VERSION, MAJOR], [ | ||
/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari | ||
], ['version', 'major', ['name', 'Mobile Safari']], [ | ||
], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [ | ||
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile | ||
], ['version', 'major', 'name'], [ | ||
], [VERSION, MAJOR, NAME], [ | ||
/applewebkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0 | ||
], ['name', ['major', mapper.string, maps.browser.oldsafari.major], ['version', mapper.string, maps.browser.oldsafari.version]], [ | ||
], [NAME, [MAJOR, mapper.string, maps.browser.oldsafari.major], [VERSION, mapper.string, maps.browser.oldsafari.version]], [ | ||
/(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror | ||
/(applewebkit|khtml)\/((\d+)?[\w\.]+)/i | ||
], ['name', 'version', 'major'], [ | ||
], [NAME, VERSION, MAJOR], [ | ||
// Gecko based | ||
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape | ||
], [['name', 'Netscape'], 'version', 'major'], [ | ||
], [[NAME, 'Netscape'], VERSION, MAJOR], [ | ||
/(swiftfox)/i, // Swiftfox | ||
@@ -191,3 +215,3 @@ /(iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo)[\/\s]?((\d+)?[\w\.\+]+)/i, | ||
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix | ||
/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla | ||
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla | ||
@@ -199,3 +223,3 @@ // Other | ||
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic | ||
], ['name', 'version', 'major'] | ||
], [NAME, VERSION, MAJOR] | ||
], | ||
@@ -206,3 +230,3 @@ | ||
/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook | ||
], ['model', 'vendor', ['type', 'Tablet']], [ | ||
], [MODEL, VENDOR, [TYPE, TABLET]], [ | ||
@@ -213,6 +237,6 @@ /(hp).+(touchpad)/i, // HP TouchPad | ||
/(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak | ||
], ['vendor', 'model', ['type', 'Tablet']], [ | ||
], [VENDOR, MODEL, [TYPE, TABLET]], [ | ||
/\((ip[honed]+);.+(apple)/i // iPod/iPhone | ||
], ['model', 'vendor', ['type', 'Mobile']], [ | ||
], [MODEL, VENDOR, [TYPE, MOBILE]], [ | ||
@@ -224,48 +248,51 @@ /(blackberry)[\s-]?(\w+)/i, // BlackBerry | ||
/(asus)-?(\w+)/i // Asus | ||
], ['vendor', 'model', ['type', 'Mobile']], [ | ||
], [VENDOR, MODEL, [TYPE, MOBILE]], [ | ||
/\((bb10);\s(\w+)/i // BlackBerry 10 | ||
], [['vendor', 'BlackBerry'], 'model', ['type', 'Mobile']], [ | ||
], [[VENDOR, 'BlackBerry'], MODEL, [TYPE, MOBILE]], [ | ||
/android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+))/i // Asus Tablets | ||
], [['vendor', 'Asus'], 'model', ['type', 'Tablet']], [ | ||
], [[VENDOR, 'Asus'], MODEL, [TYPE, TABLET]], [ | ||
/(sony)\s(tablet\s[ps])/i // Sony Tablets | ||
], ['vendor', 'model', ['type', 'Tablet']], [ | ||
], [VENDOR, MODEL, [TYPE, TABLET]], [ | ||
/(nintendo|playstation)\s([wids3portablev]+)/i // Nintendo/Playstation | ||
], ['vendor', 'model', ['type', 'Console']], [ | ||
], [VENDOR, MODEL, [TYPE, CONSOLE]], [ | ||
/(sprint\sapa)(\w+)/i | ||
], [[VENDOR, 'HTC'], [MODEL, mapper.string, maps.device.htc.model], [TYPE, MOBILE]], [ | ||
/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC | ||
/(zte)-(\w+)*/i // ZTE | ||
], ['vendor', ['model', /_/g, ' '], ['type', 'Mobile']], [ | ||
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ | ||
/\s((milestone|droid[2x]?))[globa\s]*\sbuild\//i, // Motorola | ||
/(mot)[\s-]?(\w+)*/i | ||
], [['vendor', 'Motorola'], 'model', ['type', 'Mobile']], [ | ||
], [[VENDOR, 'Motorola'], MODEL, [TYPE, MOBILE]], [ | ||
/android.+\s((mz60\d|xoom[\s2]{0,2}))\sbuild\//i | ||
], [['vendor', 'Motorola'], 'model', ['type', 'Tablet']], [ | ||
], [[VENDOR, 'Motorola'], MODEL, [TYPE, TABLET]], [ | ||
/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9))/i | ||
], [['vendor', 'Samsung'], 'model', ['type', 'Tablet']], [ // Samsung | ||
], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung | ||
/((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i, | ||
/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, | ||
/sec-((sgh\w+))/i | ||
], [['vendor', 'Samsung'], 'model', ['type', 'Mobile']], [ | ||
], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ | ||
/(sie)-(\w+)*/i // Siemens | ||
], [['vendor', 'Siemens'], 'model', ['type', 'Mobile']], [ | ||
], [[VENDOR, 'Siemens'], MODEL, [TYPE, MOBILE]], [ | ||
/(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia | ||
/(nokia)[\s_-]?([\w-]+)*/i | ||
], [['vendor', 'Nokia'], 'model', ['type', 'Mobile']], [ | ||
], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [ | ||
/android\s3\.[\s\w-;]{10}((a\d{3}))/i // Acer | ||
], [['vendor', 'Acer'], 'model', ['type', 'Tablet']], [ | ||
], [[VENDOR, 'Acer'], MODEL, [TYPE, TABLET]], [ | ||
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG | ||
], [['vendor', 'LG'], 'model', ['type', 'Tablet']], [ | ||
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ | ||
/(lg)[e;\s-\/]+(\w+)*/i | ||
], [['vendor', 'LG'], 'model', ['type', 'Mobile']], [ | ||
], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [ | ||
/(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable | ||
], ['type', 'vendor', 'model'] | ||
], [TYPE, VENDOR, MODEL] | ||
], | ||
@@ -276,9 +303,9 @@ | ||
/(presto)\/([\w\.]+)/i, // Presto | ||
/([aple]*webkit|trident|netfront)\/([\w\.]+)/i, // Webkit/Trident/NetFront | ||
/(webkit|trident|netfront)\/([\w\.]+)/i, // WebKit/Trident/NetFront | ||
/(khtml)\/([\w\.]+)/i, // KHTML | ||
/(tasman)\s([\w\.]+)/i // Tasman | ||
], ['name', 'version'], [ | ||
], [NAME, VERSION], [ | ||
/rv\:([\w\.]+).*(gecko)/i // Gecko | ||
], ['version', 'name'] | ||
], [VERSION, NAME] | ||
], | ||
@@ -290,17 +317,17 @@ | ||
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT | ||
/(windows\sphone\sos|windows\s?[mobile]*)[\s\/]?([ntce\d\.\s]+\w)/i | ||
], ['name', ['version', mapper.string, maps.os.windows.version]], [ | ||
/(windows\sphone\sos|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i | ||
], [NAME, [VERSION, mapper.string, maps.os.windows.version]], [ | ||
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i | ||
], [['name', 'Windows'], ['version', mapper.string, maps.os.windows.version]], [ | ||
], [[NAME, 'Windows'], [VERSION, mapper.string, maps.os.windows.version]], [ | ||
// Mobile/Embedded OS | ||
/\((bb)(10);/i // BlackBerry 10 | ||
], [['name', 'BlackBerry'], 'version'], [ | ||
/(blackberry).+version\/([\w\.]+)/i, // Blackberry | ||
], [[NAME, 'BlackBerry'], VERSION], [ | ||
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry | ||
/(tizen)\/([\w\.]+)/i, // Tizen | ||
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i | ||
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo | ||
], ['name', 'version'], [ | ||
], [NAME, VERSION], [ | ||
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian | ||
], [['name', 'Symbian'], 'version'],[ | ||
], [[NAME, 'Symbian'], VERSION],[ | ||
@@ -316,20 +343,20 @@ /(nintendo|playstation)\s([wids3portablev]+)/i, // Nintendo/Playstation | ||
/(gnu)\s?([\w\.]+)*/i // GNU | ||
], ['name', 'version'], [ | ||
], [NAME, VERSION], [ | ||
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS | ||
], [['name', 'Chromium OS'], 'version'],[ | ||
], [[NAME, 'Chromium OS'], VERSION],[ | ||
// Solaris | ||
/(sunos)\s?([\w\.]+\d)*/i // Solaris | ||
], [['name', 'Solaris'], 'version'], [ | ||
], [[NAME, 'Solaris'], VERSION], [ | ||
// BSD based | ||
/\s(\w*bsd|dragonfly)\s?([\w\.]+)*/i, // FreeBSD/NetBSD/OpenBSD/DragonFly | ||
], ['name', 'version'],[ | ||
/\s(\w*bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/DragonFly | ||
], [NAME, VERSION],[ | ||
/(ip[honead]+).*os\s*([\w]+)*\slike\smac/i // iOS | ||
], [['name', 'iOS'], ['version', /_/g, '.']], [ | ||
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS | ||
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [ | ||
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i, // Mac OS | ||
], ['name', ['version', /_/g, '.']], [ | ||
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS | ||
], [NAME, [VERSION, /_/g, '.']], [ | ||
@@ -339,6 +366,6 @@ // Other | ||
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX | ||
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|qnx|os\/2|amigaos|morphos)/i, | ||
// Plan9/Minix/BeOS/QNX/OS2/AmigaOS/MorphOS | ||
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos)/i, | ||
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS | ||
/(unix)\s?([\w\.]+)*/i // UNIX | ||
], ['name', 'version'] | ||
], [NAME, VERSION] | ||
] | ||
@@ -349,3 +376,3 @@ }; | ||
var ua = uastring || ((global && global.navigator && global.navigator.userAgent) ? global.navigator.userAgent : ""); | ||
var ua = uastring || ((global && global.navigator && global.navigator.userAgent) ? global.navigator.userAgent : EMPTY); | ||
@@ -390,5 +417,5 @@ this.getBrowser = function () { | ||
// check js environment | ||
if (typeof exports !== 'undefined' && !/\[object\s[DOM]*Window\]/.test(global.toString())) { | ||
if (typeof exports !== UNDEF && !/\[object\s[DOM]*Window\]/.test(global.toString())) { | ||
// nodejs env | ||
if (typeof module !== 'undefined' && module.exports) { | ||
if (typeof module !== UNDEF && module.exports) { | ||
exports = module.exports = UAParser; | ||
@@ -395,0 +422,0 @@ } |
@@ -1,2 +0,2 @@ | ||
// UA-Parser.JS v0.4.15 | ||
// UA-Parser.JS v0.5.1 | ||
// Lightweight JavaScript-based User-Agent string parser | ||
@@ -7,2 +7,2 @@ // https://github.com/faisalman/ua-parser-js | ||
// Dual licensed under GPLv2 & MIT | ||
(function(e,t){"use strict";var n={regex:function(){var e,n,r,i,s,o,u=arguments;for(n=0;n<u.length;n+=2){var a=u[n],f=u[n+1];if(typeof e=="undefined"){e={};for(i=0;i<f.length;i++)typeof f[i]=="object"?e[f[i][0]]=t:e[f[i]]=t;if(this.getUA().toString()==="")return e}for(r=0;r<a.length;r++){s=a[r].exec(this.getUA());if(!!s){for(i=0;i<f.length;i++)o=s[i+1],typeof f[i]=="object"&&f[i].length===2?e[f[i][0]]=f[i][1]:typeof f[i]=="object"&&f[i].length===3?typeof f[i][1]=="function"&&(!f[i][1].exec||!f[i][1].test)?e[f[i][0]]=o?f[i][1].call(this,o,f[i][2]):t:e[f[i][0]]=o?o.replace(f[i][1],f[i][2]):t:e[f[i]]=o?o:t;break}}if(!!s)break}return e},string:function(e,n){for(var r in n)if(n.hasOwnProperty(r))if(typeof n[r]=="object"&&n[r].length>0){for(var i=0;i<n[r].length;i++)if(e.toLowerCase().indexOf(n[r][i].toLowerCase())!==-1)return r.toString()==="undefined"?t:r}else if(e.toLowerCase().indexOf(n[r].toLowerCase())!==-1)return r.toString()==="undefined"?t:r;return e}},r={browser:{oldsafari:{major:{1:["/85","/125","/312"],2:["/412","/416","/417","/419"],"undefined":"/"},version:{"1.0":"/85",1.2:"/125",1.3:"/312","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","undefined":"/"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",RT:"ARM"}}}},i={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\smobi).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i,/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\sbrowser|iemobile|slimbrowser|baidubrowser)[\/\s]?((\d+)?[\w\.]*)/i,/ms(ie)\s((\d+)?[\w\.]+)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt)\/((\d+)?[\w\.-]+)/i],["name","version","major"],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[["name","Yandex"],"version","major"],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],["name","version","major"],[/(dolfin)\/((\d+)?[\w\.]+)/i],[["name","Dolphin"],"version","major"],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[["name","Chrome"],"version","major"],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],["version","major",["name","Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],["version","major","name"],[/applewebkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],["name",["major",n.string,r.browser.oldsafari.major],["version",n.string,r.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(applewebkit|khtml)\/((\d+)?[\w\.]+)/i],["name","version","major"],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[["name","Netscape"],"version","major"],[/(swiftfox)/i,/(iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris)[\/\s]?((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],["name","version","major"]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],["model","vendor",["type","Tablet"]],[/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],["vendor","model",["type","Tablet"]],[/\((ip[honed]+);.+(apple)/i],["model","vendor",["type","Mobile"]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],["vendor","model",["type","Mobile"]],[/\((bb10);\s(\w+)/i],[["vendor","BlackBerry"],"model",["type","Mobile"]],[/android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+))/i],[["vendor","Asus"],"model",["type","Tablet"]],[/(sony)\s(tablet\s[ps])/i],["vendor","model",["type","Tablet"]],[/(nintendo|playstation)\s([wids3portablev]+)/i],["vendor","model",["type","Console"]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i],["vendor",["model",/_/g," "],["type","Mobile"]],[/\s((milestone|droid[2x]?))[globa\s]*\sbuild\//i,/(mot)[\s-]?(\w+)*/i],[["vendor","Motorola"],"model",["type","Mobile"]],[/android.+\s((mz60\d|xoom[\s2]{0,2}))\sbuild\//i],[["vendor","Motorola"],"model",["type","Tablet"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9))/i],[["vendor","Samsung"],"model",["type","Tablet"]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[["vendor","Samsung"],"model",["type","Mobile"]],[/(sie)-(\w+)*/i],[["vendor","Siemens"],"model",["type","Mobile"]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[["vendor","Nokia"],"model",["type","Mobile"]],[/android\s3\.[\s\w-;]{10}((a\d{3}))/i],[["vendor","Acer"],"model",["type","Tablet"]],[/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i],[["vendor","LG"],"model",["type","Tablet"]],[/(lg)[e;\s-\/]+(\w+)*/i],[["vendor","LG"],"model",["type","Mobile"]],[/(mobile|tablet);.+rv\:.+gecko\//i],["type","vendor","model"]],engine:[[/(presto)\/([\w\.]+)/i,/([aple]*webkit|trident|netfront)\/([\w\.]+)/i,/(khtml)\/([\w\.]+)/i,/(tasman)\s([\w\.]+)/i],["name","version"],[/rv\:([\w\.]+).*(gecko)/i],["version","name"]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone\sos|windows\s?[mobile]*)[\s\/]?([ntce\d\.\s]+\w)/i],["name",["version",n.string,r.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",n.string,r.os.windows.version]],[/\((bb)(10);/i],[["name","BlackBerry"],"version"],[/(blackberry).+version\/([\w\.]+)/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],["name","version"],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[["name","Symbian"],"version"],[/(nintendo|playstation)\s([wids3portablev]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],["name","version"],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name","Chromium OS"],"version"],[/(sunos)\s?([\w\.]+\d)*/i],[["name","Solaris"],"version"],[/\s(\w*bsd|dragonfly)\s?([\w\.]+)*/i],["name","version"],[/(ip[honead]+).*os\s*([\w]+)*\slike\smac/i],[["name","iOS"],["version",/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],["name",["version",/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|qnx|os\/2|amigaos|morphos)/i,/(unix)\s?([\w\.]+)*/i],["name","version"]]},s=function(r){var s=r||(e&&e.navigator&&e.navigator.userAgent?e.navigator.userAgent:"");this.getBrowser=function(){return n.regex.apply(this,i.browser)},this.getDevice=function(){return n.regex.apply(this,i.device)},this.getEngine=function(){return n.regex.apply(this,i.engine)},this.getOS=function(){return n.regex.apply(this,i.os)},this.getResult=function(){return{browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice()}},this.getUA=function(){return s},this.setUA=function(e){return s=e,this},this.setUA(s)};typeof exports!="undefined"&&!/\[object\s[DOM]*Window\]/.test(e.toString())?(typeof module!="undefined"&&module.exports&&(exports=module.exports=s),exports.UAParser=s):e.UAParser=s})(this); | ||
(function(e,t){"use strict";var n="",r="function",i="undefined",s="object",o="major",u="model",a="name",f="type",l="vendor",c="version",h="console",p="mobile",d="tablet",v={regex:function(){var e,o,u,a,f,l,c=arguments;for(o=0;o<c.length;o+=2){var h=c[o],p=c[o+1];if(typeof e===i){e={};for(a=0;a<p.length;a++)typeof p[a]===s?e[p[a][0]]=t:e[p[a]]=t;if(this.getUA().toString()===n)return e}for(u=0;u<h.length;u++){f=h[u].exec(this.getUA());if(!!f){for(a=0;a<p.length;a++)l=f[a+1],typeof p[a]===s&&p[a].length===2?e[p[a][0]]=p[a][1]:typeof p[a]===s&&p[a].length===3?typeof p[a][1]===r&&(!p[a][1].exec||!p[a][1].test)?e[p[a][0]]=l?p[a][1].call(this,l,p[a][2]):t:e[p[a][0]]=l?l.replace(p[a][1],p[a][2]):t:e[p[a]]=l?l:t;break}}if(!!f)break}return e},string:function(e,n){for(var r in n)if(n.hasOwnProperty(r))if(typeof n[r]===s&&n[r].length>0){for(var o=0;o<n[r].length;o++)if(e.toLowerCase().indexOf(n[r][o].toLowerCase())!==-1)return r.toString()===i?t:r}else if(e.toLowerCase().indexOf(n[r].toLowerCase())!==-1)return r.toString()===i?t:r;return e}},m={browser:{oldsafari:{major:{1:["/85","/125","/312"],2:["/412","/416","/417","/419"],"undefined":"/"},version:{"1.0":"/85",1.2:"/125",1.3:"/312","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","undefined":"/"}}},device:{htc:{model:{"Evo Shift 4G":"7373KT"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",RT:"ARM"}}}},g={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i,/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\sbrowser|iemobile|slimbrowser|baidubrowser)[\/\s]?((\d+)?[\w\.]*)/i,/ms(ie)\s((\d+)?[\w\.]+)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt)\/((\d+)?[\w\.-]+)/i],[a,c,o],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[[a,"Yandex"],c,o],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],[a,c,o],[/(dolfin)\/((\d+)?[\w\.]+)/i],[[a,"Dolphin"],c,o],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[[a,"Chrome"],c,o],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],[c,o,[a,"Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],[c,o,a],[/applewebkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],[a,[o,v.string,m.browser.oldsafari.major],[c,v.string,m.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(applewebkit|khtml)\/((\d+)?[\w\.]+)/i],[a,c,o],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[[a,"Netscape"],c,o],[/(swiftfox)/i,/(iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris)[\/\s]?((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],[a,c,o]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[u,l,[f,d]],[/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[l,u,[f,d]],[/\((ip[honed]+);.+(apple)/i],[u,l,[f,p]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[l,u,[f,p]],[/\((bb10);\s(\w+)/i],[[l,"BlackBerry"],u,[f,p]],[/android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+))/i],[[l,"Asus"],u,[f,d]],[/(sony)\s(tablet\s[ps])/i],[l,u,[f,d]],[/(nintendo|playstation)\s([wids3portablev]+)/i],[l,u,[f,h]],[/(sprint\sapa)(\w+)/i],[[l,"HTC"],[u,v.string,m.device.htc.model],[f,p]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i],[l,[u,/_/g," "],[f,p]],[/\s((milestone|droid[2x]?))[globa\s]*\sbuild\//i,/(mot)[\s-]?(\w+)*/i],[[l,"Motorola"],u,[f,p]],[/android.+\s((mz60\d|xoom[\s2]{0,2}))\sbuild\//i],[[l,"Motorola"],u,[f,d]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9))/i],[[l,"Samsung"],u,[f,d]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[[l,"Samsung"],u,[f,p]],[/(sie)-(\w+)*/i],[[l,"Siemens"],u,[f,p]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[[l,"Nokia"],u,[f,p]],[/android\s3\.[\s\w-;]{10}((a\d{3}))/i],[[l,"Acer"],u,[f,d]],[/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i],[[l,"LG"],u,[f,d]],[/(lg)[e;\s-\/]+(\w+)*/i],[[l,"LG"],u,[f,p]],[/(mobile|tablet);.+rv\:.+gecko\//i],[f,l,u]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront)\/([\w\.]+)/i,/(khtml)\/([\w\.]+)/i,/(tasman)\s([\w\.]+)/i],[a,c],[/rv\:([\w\.]+).*(gecko)/i],[c,a]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone\sos|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[c,v.string,m.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[c,v.string,m.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],c],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],[a,c],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],c],[/(nintendo|playstation)\s([wids3portablev]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,c],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],c],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],c],[/\s(\w*bsd|dragonfly)\s?([\w\.]+)*/i],[a,c],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[c,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],[a,[c,/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos)/i,/(unix)\s?([\w\.]+)*/i],[a,c]]},y=function(r){var i=r||(e&&e.navigator&&e.navigator.userAgent?e.navigator.userAgent:n);this.getBrowser=function(){return v.regex.apply(this,g.browser)},this.getDevice=function(){return v.regex.apply(this,g.device)},this.getEngine=function(){return v.regex.apply(this,g.engine)},this.getOS=function(){return v.regex.apply(this,g.os)},this.getResult=function(){return{browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};typeof exports!==i&&!/\[object\s[DOM]*Window\]/.test(e.toString())?(typeof module!==i&&module.exports&&(exports=module.exports=y),exports.UAParser=y):e.UAParser=y})(this); |
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
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
64880
1662
107
0