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

browser-version

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-version - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

38

browser-version.js
var browserVersion = function() {
if(typeof navigator === "undefined"){
return "navigator is not defined";
}
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
}
module.exports = browserVersion;
if(typeof navigator === 'undefined'){
return 'navigator is not defined';
}
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!== null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
};
module.exports = browserVersion;
{
"name": "browser-version",
"version": "0.0.1",
"version": "0.0.2",
"description": "a module for detecting the browser version",
"main": "js/browser-version.js",
"main": "browser-version.js",
"repository": {

@@ -15,3 +15,3 @@ "type": "git",

"tape": "*"
},
},
"testling": {

@@ -27,6 +27,6 @@ "files": "test/*.js",

},
"scripts": {
"scripts": {
"test": "tape test/*.js"
},
"browser": [
"browser": [
"version",

@@ -36,2 +36,2 @@ "detect",

]
}
}

@@ -5,5 +5,5 @@ var test = require('tape');

test('version is chrome', function (t) {
t.equal(browserVersion(), "Chrome 39");
t.equal(2 + 3, 5);
t.end();
t.equal(browserVersion(), 'Chrome 39');
t.equal(2 + 3, 5);
t.end();
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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