/
var
/
www
/
flurhymez
/
node_modules
/
detect-node
/
/var/www/flurhymez/node_modules/detect-node
mkdir
upload
Name
Size
Mode
Actions
browser.js
25
0644
edit
dl
rm
index.esm.js
184
0644
edit
dl
rm
index.js
186
0644
edit
dl
rm
LICENSE
1068
0644
edit
dl
rm
package.json
1410
0644
edit
dl
rm
Readme.md
691
0644
edit
dl
rm
Edit:
/var/www/flurhymez/node_modules/detect-node/Readme.md
(691B)
### Install ```shell npm install --save detect-node ``` ### Usage: ```js var isNode = require('detect-node'); if (isNode) { console.log("Running under Node.JS"); } else { alert("Hello from browser (or whatever not-a-node env)"); } ``` The check is performed as: ```js module.exports = false; // Only Node.JS has a process variable that is of [[Class]] process try { module.exports = Object.prototype.toString.call(global.process) === '[object process]' } catch(e) {} ``` Thanks to Ingvar Stepanyan for the initial idea. This check is both **the most reliable I could find** and it does not use `process` env directly, which would cause browserify to include it into the build.
Save
cmd:
run