{"name":"detect-node","version":"2.0.3","description":"Detect Node.JS (as opposite to browser environment) (reliable)","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/iliakan/detect-node"},"keywords":["detect","node"],"author":{"name":"Ilya Kantor"},"license":"ISC","bugs":{"url":"https://github.com/iliakan/detect-node/issues"},"homepage":"https://github.com/iliakan/detect-node","gitHead":"4837fa0620d2e8db948a718a8b5f89a8073c8ff4","_id":"detect-node@2.0.3","_shasum":"a2033c09cc8e158d37748fbde7507832bd6ce127","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"dist":{"shasum":"a2033c09cc8e158d37748fbde7507832bd6ce127","tarball":"http://registry-npm.ywwl.com/detect-node/download/detect-node-2.0.3.tgz","integrity":"sha512-64uDTOK+fKEa6XoSbkkDoeAX8Ep1XhwxwZtL1aw1En5p5UOK/ekJoFqd5BB1o+uOvF1iHVv6qDUxdOQ/VgWEQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDU2e/hFSoUF+wPjtxqF0BqGYqgS2xflSyWZ602GPy/egIhAOS6nvgOb5rjrLcoaSkEcTrVIzCBTbhbr6YkOsFQe5MJ"}],"size":844,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.3.tgz"},"directories":{},"readme":"### Install\n\n```shell\nnpm install --save detect-node\n```\n\n### Usage:\n\n```js\nvar isNode = require('detect-node');\n\nif (isNode) {\n  console.log(\"Running under Node.JS\");\n} else {\n  alert(\"Hello from browser (or whatever not-a-node env)\");\n}\n```\n\nThe check is performed as:\n```js\nmodule.exports = false;\n\n// Only Node.JS has a process variable that is of [[Class]] process\ntry {\n module.exports = Object.prototype.toString.call(global.process) === '[object process]' \n} catch(e) {}\n\n```\n\nThanks 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.\n","publish_time":1406910520851,"_cnpm_publish_time":1406910520851,"dist-tags":{"latest":"2.1.0"}}