Socket
Socket
Sign inDemoInstall

useragent

Package Overview
Dependencies
1
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.7 to 2.0.8

17

index.js

@@ -289,3 +289,6 @@ 'use strict';

* @constructor
* @param {String} family The name of the os
* @param {String} family The name of the device
* @param {String} major Major version of the device
* @param {String} minor Minor version of the device
* @param {String} patch Patch version of the device
* @api public

@@ -524,2 +527,3 @@ */

, webkit: false
, android: false
, version: (ua.match(exports.is.versionRE) || [0, "0"])[1]

@@ -531,2 +535,6 @@ };

if (~ua.indexOf('android')){
details.android = true;
}
if (~ua.indexOf('chrome')) {

@@ -543,2 +551,4 @@ details.chrome = true;

details.opera = true;
} else if (~ua.indexOf('trident')) {
details.ie = true;
} else if (~ua.indexOf('mozilla') && !~ua.indexOf('compatible')) {

@@ -548,6 +558,5 @@ details.mozilla = true;

if (~ua.indexOf('firefox')) details.firefox = true;
} else if (~ua.indexOf('msie')) {
details.ie = true;
}
}
return details;

@@ -554,0 +563,0 @@ };

{
"name": "useragent",
"version": "2.0.7",
"version": "2.0.8",
"description": "Fastest, most accurate & effecient user agent string parser, uses Browserscope's research for parsing",

@@ -5,0 +5,0 @@ "author": "Arnout Kazemier",

@@ -171,2 +171,4 @@ # useragent - high performance user agent parser for Node.js

firefox: true
mozilla: true
android: false
}

@@ -173,0 +175,0 @@ ```

@@ -12,23 +12,23 @@ describe('useragent', function () {

it('should expose the Agent interface', function () {
useragent.Agent.should.be.a('function');
useragent.Agent.should.be.a.Function;
});
it('should expose the OperatingSystem interface', function () {
useragent.OperatingSystem.should.be.a('function');
useragent.OperatingSystem.should.be.a.Function;
});
it('should expose the Device interface', function () {
useragent.Device.should.be.a('function');
useragent.Device.should.be.a.Function;
});
it('should expose the dictionary lookup', function () {
useragent.lookup.should.be.a('function');
useragent.lookup.should.be.a.Function;
});
it('should expose the parser', function () {
useragent.parse.should.be.a('function');
useragent.parse.should.be.a.Function;
});
it('should expose the useragent tester', function () {
useragent.is.should.be.a('function');
useragent.is.should.be.a.Function;
});

@@ -140,5 +140,7 @@

, ie = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; yie8)'
, ie11 = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'
, opera = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; de) Opera 11.51'
, safari = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1'
, ipod = 'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5';
, ipod = 'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5'
, android = 'Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1';

@@ -159,2 +161,3 @@ it('should not throw errors when called without arguments', function () {

useragent.is(chrome).mobile_safari.should.equal(false);
useragent.is(chrome).android.should.equal(false);
});

@@ -171,2 +174,3 @@

useragent.is(firefox).mobile_safari.should.equal(false);
useragent.is(firefox).android.should.equal(false);
});

@@ -183,2 +187,13 @@

useragent.is(ie).mobile_safari.should.equal(false);
useragent.is(ie).android.should.equal(false);
useragent.is(ie11).chrome.should.equal(false);
useragent.is(ie11).webkit.should.equal(false);
useragent.is(ie11).safari.should.equal(false);
useragent.is(ie11).firefox.should.equal(false);
useragent.is(ie11).mozilla.should.equal(false);
useragent.is(ie11).ie.should.equal(true);
useragent.is(ie11).opera.should.equal(false);
useragent.is(ie11).mobile_safari.should.equal(false);
useragent.is(ie11).android.should.equal(false);
});

@@ -195,2 +210,3 @@

useragent.is(opera).mobile_safari.should.equal(false);
useragent.is(opera).android.should.equal(false);
});

@@ -207,2 +223,3 @@

useragent.is(safari).mobile_safari.should.equal(false);
useragent.is(safari).android.should.equal(false);
});

@@ -219,4 +236,17 @@

useragent.is(ipod).mobile_safari.should.equal(true);
useragent.is(ipod).android.should.equal(false);
});
it('should correctly detect android', function () {
useragent.is(android).chrome.should.equal(false);
useragent.is(android).webkit.should.equal(true);
useragent.is(android).safari.should.equal(true);
useragent.is(android).firefox.should.equal(false);
useragent.is(android).mozilla.should.equal(false);
useragent.is(android).ie.should.equal(false);
useragent.is(android).opera.should.equal(false);
useragent.is(android).mobile_safari.should.equal(true);
useragent.is(android).android.should.equal(true);
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc