(copied from the text of #65)
So this is a reasonably simple change, but one that should have a pretty big impact for people who have been hit with the code path which is returning a false positive on node detection (see #54).
It changes two things:
We do browser detection if at all possible (i.e. navigator is defined). This then falls back to detecting the node environment if that isn't available.
-
Removes the require('os') import for os detection and simply uses process.platform instead. The information won't be as detailed and it's possible that a user of this module may still want to opt to do their own check using the os module. Given that the majority use case is web browser detection though I think that makes sense. Should stop browserify bringing in any shims for the os module also (which is a good thing).
-
Because of point 2 though, I believe we should do a major version bump to 3.0.0 to ensure that no-one that is using detect-browser in an isomorphic way is caught out unexpectedly.