Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browser-info

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-info - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

14

index.js

@@ -11,3 +11,3 @@ /* globals navigator*/

var match = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
var match = ua.match(/(opera|chrome|safari|firefox|msie|edge|trident(?=\/))\/?\s*(\d+)/i) || [];

@@ -29,2 +29,5 @@ if (ua.indexOf('Win') !== -1) {

}
if (/iPad|iPhone|iPod/.test(ua)) {
os = 'iOS';
}

@@ -48,2 +51,11 @@ if (/trident/i.test(match[1])) {

}
tem = ua.match(/\bEdge\/(\d+)/);
if (tem !== null) {
return {
name: 'Edge',
version: tem[1],
os: os
};
}
}

@@ -50,0 +62,0 @@ match = match[2]? [match[1], match[2]]: [navigator.appName, navigator.appVersion, '-?'];

2

package.json
{
"name": "browser-info",
"version": "0.1.0",
"version": "0.2.0",
"description": "Get browser info",

@@ -5,0 +5,0 @@ "author": "Steve Lacy <me@slacy.me> (http://slacy.me)",

@@ -27,2 +27,19 @@ 'use strict';

it('should detect iOS', function(done) {
GLOBAL.navigator = {
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
};
should(info().os).equal('iOS');
done();
});
it('should detect Edge', function(done) {
GLOBAL.navigator = {
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/13'
};
should(info().name).equal('Edge');
done();
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc