{"name":"detect-node","version":"1.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","_id":"detect-node@1.0.0","_shasum":"0dce710909dcb78d46a44889f8b78c983d27f1df","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"dist":{"shasum":"0dce710909dcb78d46a44889f8b78c983d27f1df","tarball":"http://registry-npm.ywwl.com/detect-node/download/detect-node-1.0.0.tgz","integrity":"sha512-gcjE0mv88PI1EKvIg4InC5RqVmshYyqUVOT9WyGi2V+4GCMMp3+72qiZfCtOXy/tlHTZFrwrUvp0TvACaqlIKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDklCnfux71dGo3Af51qGpHBdP+hsYf+0hOnbqP6vJGIwIgeZynk/5pXO/YSV4KMpna8dHBGEk39QtpeQVOtoqt9i0="}],"size":654,"noattachment":false,"key":"/detect-node/-/detect-node-1.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":1406802021252,"_cnpm_publish_time":1406802021252,"dist-tags":{"latest":"2.1.0"}}