mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-28 00:18:45 +03:00
Add CPU test & increment minor version
This commit is contained in:
parent
ecf8f7a849
commit
dc20c12b63
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.27",
|
"version": "0.6.0",
|
||||||
"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": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.27",
|
"version": "0.6.0",
|
||||||
"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.27
|
// UAParser.js v0.6.0
|
||||||
// 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
|
||||||
//
|
//
|
||||||
@ -100,6 +100,8 @@
|
|||||||
// sanitize match using given regex
|
// sanitize match using given regex
|
||||||
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
||||||
}
|
}
|
||||||
|
} else if (q.length == 4) {
|
||||||
|
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result[q] = match ? match : undefined;
|
result[q] = match ? match : undefined;
|
||||||
@ -276,6 +278,7 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
cpu : [[
|
cpu : [[
|
||||||
|
|
||||||
/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64
|
/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64
|
||||||
], [[ARCHITECTURE, 'amd64']], [
|
], [[ARCHITECTURE, 'amd64']], [
|
||||||
|
|
||||||
@ -283,7 +286,7 @@
|
|||||||
], [[ARCHITECTURE, 'ia32']], [
|
], [[ARCHITECTURE, 'ia32']], [
|
||||||
|
|
||||||
/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC
|
/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC
|
||||||
], [[ARCHITECTURE, /ower/, '']], [
|
], [[ARCHITECTURE, /ower/, '', util.lowerize]], [
|
||||||
|
|
||||||
/(sun4\w)[;\)]/i // SPARC
|
/(sun4\w)[;\)]/i // SPARC
|
||||||
], [[ARCHITECTURE, 'sparc']], [
|
], [[ARCHITECTURE, 'sparc']], [
|
||||||
|
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
81
test/cpu-test.json
Normal file
81
test/cpu-test.json
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"desc" : "i686",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ia32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "i386",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040628 Epiphany/1.2.6",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ia32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "x86-64",
|
||||||
|
"ua" : "Opera/9.80 (X11; Linux x86_64; U; Linux Mint; en) Presto/2.2.15 Version/10.10",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "win64",
|
||||||
|
"ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Win64; x64; Trident/6.0; .NET4.0E; .NET4.0C)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WOW64",
|
||||||
|
"ua" : "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMv6",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac PowerPC",
|
||||||
|
"ua" : "Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac PowerPC",
|
||||||
|
"ua" : "Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC Mac OS; en)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac PowerPC",
|
||||||
|
"ua" : "iCab/2.9.5 (Macintosh; U; PPC; Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "UltraSPARC",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "sparc"
|
||||||
|
}
|
||||||
|
}]
|
@ -1,6 +1,7 @@
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var UAParser = require('./../src/ua-parser');
|
var UAParser = require('./../src/ua-parser');
|
||||||
var browsers = require('./browser-test.json');
|
var browsers = require('./browser-test.json');
|
||||||
|
var cpus = require('./cpu-test.json');
|
||||||
var devices = require('./device-test.json');
|
var devices = require('./device-test.json');
|
||||||
var engines = require('./engine-test.json');
|
var engines = require('./engine-test.json');
|
||||||
var os = require('./os-test.json');
|
var os = require('./os-test.json');
|
||||||
@ -12,6 +13,12 @@ var methods = [
|
|||||||
list : browsers,
|
list : browsers,
|
||||||
properties : ['name', 'major', 'version']
|
properties : ['name', 'major', 'version']
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title : 'getCPU',
|
||||||
|
label : 'cpu',
|
||||||
|
list : cpus,
|
||||||
|
properties : ['architecture']
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title : 'getDevice',
|
title : 'getDevice',
|
||||||
label : 'device',
|
label : 'device',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.27",
|
"version": "0.6.0",
|
||||||
"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