2.0
This is a significant change to the way that detect-browser behaves. Prior to this release, simply requiring the module would mean that a browser detection action would occur. This, however, will not produce consistent behaviour across ES6 and node module resolution systems. As such, a detect function is now made available and must be invoked for the detection to be completed (as per the example below - or the examples included in the README):
const { detect } = require('detect-browser');
const browser = detect();
// handle the case where we don't detect the browser
if (browser) {
console.log(browser.name);
console.log(browser.version);
}Additionally, the implementation of the module has been condensed into a single file with the view to having compliance with other module packaging systems as well as browserify. It is expected that there will be patch changes to detect-browser over the coming months as integration with other tools is explored.