Comparing version 2.0.0 to 3.0.0
@@ -7,17 +7,3 @@ /* jshint node: true */ | ||
var semver = require('semver'); | ||
var browsers = { | ||
chrome: [ | ||
/Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ | ||
], | ||
firefox: [ | ||
/Firefox\/([0-9\.]+)(?:\s|$)/ | ||
], | ||
opera: [ | ||
/Opera\/([0-9\.]+)(?:\s|$)/ | ||
], | ||
ie: [ | ||
/Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/ // IE11 | ||
] | ||
}; | ||
var browser = require('detect-browser'); | ||
@@ -84,36 +70,4 @@ /** | ||
// time to do some useragent sniffing - it feels dirty because it is :/ | ||
if (typeof navigator != 'undefined') { | ||
Object.keys(browsers).forEach(function(key) { | ||
// get the first matching regex | ||
var match = browsers[key].map(function(regex) { | ||
return regex.exec(navigator.userAgent); | ||
}).filter(Boolean)[0]; | ||
if (match) { | ||
detect.browser = key; | ||
detect.browserVersion = detect.version = parseVersion(match[1]); | ||
} | ||
}); | ||
// if the browser has not been detected, then set the browser to unknown | ||
detect.browser = detect.browser || 'unknown'; | ||
} | ||
else { | ||
detect.browser = 'node'; | ||
detect.browserVersion = detect.version = parseVersion(process.version.substr(1)); | ||
} | ||
function parseVersion(version) { | ||
// get the version parts | ||
var versionParts = version.split('.').slice(0, 3); | ||
// while we don't have enough parts for the semver spec, add more zeros | ||
while (versionParts.length < 3) { | ||
versionParts.push('0'); | ||
} | ||
// return the version cleaned version (hopefully) | ||
// falling back to the provided version if required | ||
return semver.clean(versionParts.join('.')) || version; | ||
} | ||
// set the browser and browser version | ||
detect.browser = browser.name; | ||
detect.browserVersion = detect.version = browser.version; |
{ | ||
"name": "rtc-core", | ||
"description": "Core definitions and functions for the rtc.io suite", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"dependencies": { | ||
"semver": "^2" | ||
"detect-browser": "^1.0.0" | ||
}, | ||
@@ -8,0 +8,0 @@ "devDependencies": { |
require('./detect'); | ||
require('./detect-browser'); | ||
require('./match'); | ||
require('./plugin'); |
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
22240
20
192
+ Addeddetect-browser@^1.0.0
+ Addeddetect-browser@1.12.0(transitive)
- Removedsemver@^2
- Removedsemver@2.3.2(transitive)