Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Apr 5, 2021
2 parents 383ca58 + f95aced commit f726dcd
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ua-parser-js",
"version": "0.7.26",
"version": "0.7.27",
"authors": [
"Faisal Salman <[email protected]>"
],
Expand Down
4 changes: 2 additions & 2 deletions dist/ua-parser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ua-parser.pack.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'faisalman:ua-parser-js',
version: '0.7.26',
version: '0.7.27',
summary: 'Lightweight JavaScript-based user-agent string parser',
git: 'https://github.com/faisalman/ua-parser-js.git',
documentation: 'readme.md'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "0.7.26",
"version": "0.7.27",
"author": "Faisal Salman <[email protected]> (http://faisalman.com)",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ console, mobile, tablet, smarttv, wearable, embedded

# Possible 'device.vendor':
Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
Essential, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu,
Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
Essential, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG,
Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
Palm, Panasonic, Pebble, Polytron, Realme, RIM, Samsung, Sharp, Siemens,
Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...

Expand Down
8 changes: 5 additions & 3 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!@license
* UAParser.js v0.7.26
* UAParser.js v0.7.27
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
Expand All @@ -16,7 +16,7 @@
/////////////


var LIBVERSION = '0.7.26',
var LIBVERSION = '0.7.27',
EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
Expand Down Expand Up @@ -541,6 +541,8 @@

/\s(surface\sduo)\s/i // Surface Duo
], [MODEL, [VENDOR, 'Microsoft'], [TYPE, TABLET]], [
/droid\s[\d\.]+;\s(fp\du?)\sbuild/i
], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
/\s(u304aa)\sbuild/i // AT&T
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
/sie-(\w*)/i // Siemens
Expand Down Expand Up @@ -814,7 +816,7 @@
return _ua;
};
this.setUA = function (ua) {
_ua = ua.length > UA_MAX_LENGTH ? util.trim(ua, UA_MAX_LENGTH) : ua;
_ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? util.trim(ua, UA_MAX_LENGTH) : ua;
return this;
};
this.setUA(_ua);
Expand Down
9 changes: 9 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@
"type": "mobile"
}
},
{
"desc": "Fairphone 1U",
"ua": "Mozilla/5.0 (Linux; U; Android 4.2.2; FP1U Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
"expect": {
"vendor": "Fairphone",
"model": "FP1U",
"type": "mobile"
}
},
{
"desc": "HTC Desire 820",
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; HTC Desire 820 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36",
Expand Down
8 changes: 8 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ describe('UAParser()', function () {
assert.deepStrictEqual(UAParser(ua), new UAParser().setUA(ua).getResult());
});

describe('UAParser() constructor does not throw with undefined ua argument', function () {
assert.doesNotThrow(() => new UAParser(undefined).getResult());
});

describe('UAParser.setUA method does not throw with undefined ua argument', function () {
assert.doesNotThrow(() => new UAParser().setUA(undefined).getResult());
});

for (var i in methods) {
describe(methods[i]['title'], function () {
for (var j in methods[i]['list']) {
Expand Down

0 comments on commit f726dcd

Please sign in to comment.