Make module work in node environments where `window` global is defined

Previously, having `window` defined in the global context made this
module behave as if wasn't running in node. I am attempting to use it
in a node environment where there is also a global window object, so
the nature of the check is causing problems. This commit changes the
check… it tries to determine if we're running in Node by instead of if
we're *not* running in Node by looking for the `process.versions`
hash. It also always tries to use require if it exists, rather than
skipping it if we have a window defined.