detect-browser
Advanced tools
Comparing version 4.0.1 to 4.0.2
19
index.js
@@ -116,12 +116,12 @@ "use strict"; | ||
} | ||
var version = match[1] && match[1].split(/[._]/).slice(0, 3); | ||
if (version) { | ||
if (version.length < REQUIRED_VERSION_PARTS) { | ||
version = version.concat(new Array(REQUIRED_VERSION_PARTS - version.length).fill('0')); | ||
var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3); | ||
if (versionParts) { | ||
if (versionParts.length < REQUIRED_VERSION_PARTS) { | ||
versionParts = versionParts.concat(createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length)); | ||
} | ||
} | ||
else { | ||
version = []; | ||
versionParts = []; | ||
} | ||
return new BrowserInfo(name, version.join('.'), detectOS(ua)); | ||
return new BrowserInfo(name, versionParts.join('.'), detectOS(ua)); | ||
} | ||
@@ -142,1 +142,8 @@ exports.parseUserAgent = parseUserAgent; | ||
exports.getNodeVersion = getNodeVersion; | ||
function createVersionParts(count) { | ||
var output = []; | ||
for (var ii = 0; ii < count; ii++) { | ||
output.push('0'); | ||
} | ||
return output; | ||
} |
{ | ||
"name": "detect-browser", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Unpack a browser type and version from the useragent string", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
33278
203