{"name":"detect-node","version":"2.0.0","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":"3e1d2591bdbf5e3ac1d36f4b81ddb91f37fc2280","_id":"detect-node@2.0.0","_shasum":"5ed01329818006b14a19ac8f68ec1e1a65cce725","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"dist":{"shasum":"5ed01329818006b14a19ac8f68ec1e1a65cce725","tarball":"http://registry-npm.ywwl.com/detect-node/download/detect-node-2.0.0.tgz","integrity":"sha512-U+oUAYJyg+e9wXu+fuBHOhA3GJMReL8dTiS1fszrIMtT4eBUSg2T7MuIcpyMqDNS8qHTVFxZC7so9DHUuw5+tQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCH0kjjpqfuOudTZkcxHAVCzl+SfrAT0/BVnozaag3CBgCIQDIVqrYSMEu9cq1IutTtCcI6WYBqeVRJ/KG7ZMyfKcJ6A=="}],"size":804,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.0.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":1406802655255,"_cnpm_publish_time":1406802655255,"dist-tags":{"latest":"2.1.0"}}