browser-version
Advanced tools
Comparing version 0.0.1 to 0.0.2
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
1968
6
26
1