added check for module as well as require for node environment

When using requireJS in the browser, it attempts to load modules defined
by require(). Not sure if these can be configured to load in browser too
but quick fix is just to add extra check to ensure node environment.
Merge pull request #23 from phola/master

added check for module as well as require for node environment