Running under Node or not References How to check whether a script is running under Node.js? - Stack Overflow Usage function isNodeEnvironment() { return typeof window === 'undefined'; }