Include ua in result object

This commit is contained in:
Faisal Salman 2013-04-04 14:50:46 +07:00
parent 8d439d26b8
commit be0eec6716
6 changed files with 15 additions and 11 deletions

View File

@ -1,8 +1,8 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.6.0", "version": "0.6.1",
"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", "cpu"],
"scripts": ["src/ua-parser.js"], "scripts": ["src/ua-parser.js"],
"main": "src/ua-parser.js", "main": "src/ua-parser.js",
"license": "MIT", "license": "MIT",

View File

@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.6.0", "version": "0.6.1",
"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": [
@ -10,7 +10,8 @@
"browser", "browser",
"engine", "engine",
"os", "os",
"device" "device",
"cpu"
], ],
"homepage": "http://github.com/faisalman/ua-parser-js", "homepage": "http://github.com/faisalman/ua-parser-js",
"contributors": [ "contributors": [

View File

@ -10,7 +10,7 @@ Lightweight JavaScript-based User-Agent string parser. Supports browser & node.j
## Features ## Features
Extract detailed type of web browser, layout engine, operating system, and device purely from user-agent string with relatively lightweight footprint (~7KB minified / ~3KB gzipped). Written in vanilla js, which means it doesn't depends on any other library. Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device purely from user-agent string with relatively lightweight footprint (~7KB minified / ~3KB gzipped). Written in vanilla js, which means it doesn't depends on any other library.
![It's over 9000](https://pbs.twimg.com/media/A9LpEG6CIAA5VrT.jpg) ![It's over 9000](https://pbs.twimg.com/media/A9LpEG6CIAA5VrT.jpg)
@ -78,11 +78,11 @@ Windows [Phone/Mobile], Zenwalk
``` ```
# Possible 'cpu.architecture' # Possible 'cpu.architecture'
68k, amd64, arm, ia32, ia64, irix, mips, pa-risc, ppc, sparc 68k, amd64, arm, ia32, ia64, irix, irix64, mips, mips64, pa-risc, ppc, sparc, sparc64
``` ```
* `getResult()` * `getResult()`
* returns `{ browser: {}, cpu: {}, device: {}, engine: {}, os: {} }` * returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
* `getUA()` * `getUA()`
* returns UA string of current instance * returns UA string of current instance
* `setUA(uastring)` * `setUA(uastring)`
@ -104,6 +104,7 @@ Windows [Phone/Mobile], Zenwalk
/* /*
/// this will print an object structured like this: /// this will print an object structured like this:
{ {
ua: "",
browser: { browser: {
name: "", name: "",
version: "", version: "",

View File

@ -1,4 +1,4 @@
// UAParser.js v0.6.0 // UAParser.js v0.6.1
// 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
// //
@ -479,6 +479,7 @@
}; };
this.getResult = function() { this.getResult = function() {
return { return {
ua : this.getUA(),
browser : this.getBrowser(), browser : this.getBrowser(),
engine : this.getEngine(), engine : this.getEngine(),
os : this.getOS(), os : this.getOS(),

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.6.0", "version": "0.6.1",
"description": "Lightweight JavaScript-based user-agent string parser", "description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [ "keywords": [
"user-agent", "user-agent",
@ -9,7 +9,8 @@
"browser", "browser",
"engine", "engine",
"os", "os",
"device" "device",
"cpu"
], ],
"homepage": "https://faisalman.github.com/ua-parser-js", "homepage": "https://faisalman.github.com/ua-parser-js",
"author": { "author": {