mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
commit
5cc6bf78a5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
@ -17,6 +17,12 @@
|
||||
"Faisal Salman <fyzlman@gmail.com>"
|
||||
],
|
||||
"main": "ua-parser",
|
||||
"scripts": {
|
||||
"test": "./node_modules/mocha/bin/mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": ">= 1.7.1"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
|
10
test.js
Normal file
10
test.js
Normal file
@ -0,0 +1,10 @@
|
||||
var assert = require("assert");
|
||||
var UAParser = require("./ua-parser");
|
||||
|
||||
describe('getDevice', function () {
|
||||
it('should return the model', function () {
|
||||
var parser = new UAParser('Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.11 (KHTML, like Gecko) Version/7.1.0.7 Safari/534.11');
|
||||
var device = parser.getDevice();
|
||||
assert.equal(device.model, "PlayBook");
|
||||
});
|
||||
});
|
@ -358,7 +358,7 @@
|
||||
};
|
||||
|
||||
// check whether script is running inside node.js export as module
|
||||
if (typeof exports !== 'undefined' && this.toString() !== '[object DOMWindow]') {
|
||||
if (typeof exports !== 'undefined' && (!this || this.toString() !== '[object DOMWindow]')) {
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
exports = module.exports = UAParser;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user