Improve Node.js module/require detection

- improves support for environments which include `module` but are not Node.js environments
- fixes #51 "can't be used in karma tests for angular"