mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Fix error build
This commit is contained in:
parent
e58c93fe0a
commit
e89e8173f5
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.20",
|
"version": "0.5.22",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device"],
|
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device"],
|
||||||
"scripts": ["src/ua-parser.js"],
|
"scripts": ["src/ua-parser.js"],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UA-Parser.JS",
|
"title": "UA-Parser.JS",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.20",
|
"version": "0.5.22",
|
||||||
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// UAParser.js v0.5.21
|
// UAParser.js v0.5.22
|
||||||
// Lightweight JavaScript-based User-Agent string parser
|
// Lightweight JavaScript-based User-Agent string parser
|
||||||
// https://github.com/faisalman/ua-parser-js
|
// https://github.com/faisalman/ua-parser-js
|
||||||
//
|
//
|
||||||
@ -39,7 +39,7 @@
|
|||||||
has : function (str1, str2) {
|
has : function (str1, str2) {
|
||||||
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
|
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
isType : function (obj, str) {
|
is : function (obj, str) {
|
||||||
return typeof obj === str;
|
return typeof obj === str;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -55,19 +55,20 @@
|
|||||||
rgx : function () {
|
rgx : function () {
|
||||||
|
|
||||||
// loop through all regexes maps
|
// loop through all regexes maps
|
||||||
for (var result, i = 0, j, k, p, matches, match, args = arguments; i < args.length; i += 2) {
|
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
|
||||||
|
|
||||||
var regex = args[i], // even sequence (0,2,4,..)
|
var regex = args[i], // even sequence (0,2,4,..)
|
||||||
props = args[i + 1]; // odd sequence (1,3,5,..)
|
props = args[i + 1]; // odd sequence (1,3,5,..)
|
||||||
|
|
||||||
// construct object barebones
|
// construct object barebones
|
||||||
if (util.isType(result, UNDEF_TYPE)) {
|
if (util.is(result, UNDEF_TYPE)) {
|
||||||
result = {};
|
result = {};
|
||||||
for (p in props) {
|
for (p in props) {
|
||||||
if (util.isType(p, OBJ_TYPE)) {
|
q = props[p];
|
||||||
result[p[0]] = undefined;
|
if (util.is(q, OBJ_TYPE)) {
|
||||||
|
result[q[0]] = undefined;
|
||||||
} else {
|
} else {
|
||||||
result[p] = undefined;
|
result[q] = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,24 +78,25 @@
|
|||||||
matches = regex[j].exec(this.getUA());
|
matches = regex[j].exec(this.getUA());
|
||||||
if (!!matches) {
|
if (!!matches) {
|
||||||
for (p in props) {
|
for (p in props) {
|
||||||
match = matches[k + 1];
|
match = matches[++k];
|
||||||
|
q = props[p];
|
||||||
// check if given property is actually array
|
// check if given property is actually array
|
||||||
if (util.isType(p, OBJ_TYPE)) {
|
if (util.is(q, OBJ_TYPE)) {
|
||||||
if (p.length == 2) {
|
if (q.length == 2) {
|
||||||
// assign given value, ignore regex match
|
// assign given value, ignore regex match
|
||||||
result[p[0]] = p[1];
|
result[q[0]] = q[1];
|
||||||
} else if (p.length == 3) {
|
} else if (q.length == 3) {
|
||||||
// check whether function or regex
|
// check whether function or regex
|
||||||
if (util.isType(p[1], FUNC_TYPE) && !(p[1].exec && p[1].test)) {
|
if (util.is(q[1], FUNC_TYPE) && !(q[1].exec && q[1].test)) {
|
||||||
// call function (usually string mapper)
|
// call function (usually string mapper)
|
||||||
result[p[0]] = match ? p[1].call(this, match, p[2]) : undefined;
|
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
|
||||||
} else {
|
} else {
|
||||||
// sanitize match using given regex
|
// sanitize match using given regex
|
||||||
result[p[0]] = match ? match.replace(p[1], p[2]) : undefined;
|
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result[p] = match ? match : undefined;
|
result[q] = match ? match : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -110,9 +112,9 @@
|
|||||||
|
|
||||||
for (var i in map) {
|
for (var i in map) {
|
||||||
// check if array
|
// check if array
|
||||||
if (util.isType(map[i], OBJ_TYPE) && map[i].length > 0) {
|
if (util.is(map[i], OBJ_TYPE) && map[i].length > 0) {
|
||||||
for (var j in map[i]) {
|
for (var j in map[i]) {
|
||||||
if (util.has(j, str)) {
|
if (util.has(map[i][j], str)) {
|
||||||
return (i === UNKNOWN) ? undefined : i;
|
return (i === UNKNOWN) ? undefined : i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,13 +467,13 @@
|
|||||||
|
|
||||||
|
|
||||||
// check js environment
|
// check js environment
|
||||||
if (!util.isType(exports, UNDEF_TYPE)) {
|
if (!util.is(exports, UNDEF_TYPE)) {
|
||||||
// nodejs env
|
// nodejs env
|
||||||
if (!util.isType(module, UNDEF_TYPE) && module.exports) {
|
if (!util.is(module, UNDEF_TYPE) && module.exports) {
|
||||||
exports = module.exports = UAParser;
|
exports = module.exports = UAParser;
|
||||||
}
|
}
|
||||||
exports.UAParser = UAParser;
|
exports.UAParser = UAParser;
|
||||||
} else if (util.isType(define, FUNC_TYPE) && define.amd) {
|
} else if (util.is(define, FUNC_TYPE) && define.amd) {
|
||||||
// requirejs env
|
// requirejs env
|
||||||
define(function() {
|
define(function() {
|
||||||
return UAParser;
|
return UAParser;
|
||||||
@ -480,7 +482,7 @@
|
|||||||
// browser env
|
// browser env
|
||||||
window.UAParser = UAParser;
|
window.UAParser = UAParser;
|
||||||
// jQuery specific (optional)
|
// jQuery specific (optional)
|
||||||
if (!util.isType(window.jQuery, UNDEF_TYPE)) {
|
if (!util.is(window.jQuery, UNDEF_TYPE)) {
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
var parser = new UAParser();
|
var parser = new UAParser();
|
||||||
$.ua = parser.getResult();
|
$.ua = parser.getResult();
|
||||||
@ -497,4 +499,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})(this);
|
})(this);
|
||||||
|
4
src/ua-parser.min.js
vendored
4
src/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UA-Parser.JS",
|
"title": "UA-Parser.JS",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.20",
|
"version": "0.5.22",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"user-agent",
|
"user-agent",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user