{"name":"detect-node","version":"2.0.2","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","_id":"detect-node@2.0.2","_shasum":"1d35ceac9f2b4becc5e8eae0f46a70c730e921f5","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"dist":{"shasum":"1d35ceac9f2b4becc5e8eae0f46a70c730e921f5","tarball":"http://registry-npm.ywwl.com/detect-node/download/detect-node-2.0.2.tgz","integrity":"sha512-UoejuCqm/KueA9M+LVU5kUmCAex5Jqo72MJi1Qtnn3TQydzwSVyopYuc0BcrG0MSQ8X8/DUEKlRFpzbXp4EzEA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBMMaYYjJ2/wEL1lv9AryZB59NXDkqxLPrGtbSsNJoIXAiEAs56ZDcSXJth0MFucTfBjWK8QmxHLIgOSfSvRd+foVDc="}],"size":868,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.2.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":1406802999833,"_cnpm_publish_time":1406802999833,"dist-tags":{"latest":"2.1.0"}}