{"name":"detect-node","version":"2.0.1","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.1","_shasum":"d10f1b84000e46670f9f3d1456d92d07a3ac3bdf","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"dist":{"shasum":"d10f1b84000e46670f9f3d1456d92d07a3ac3bdf","tarball":"http://registry-npm.ywwl.com/detect-node/download/detect-node-2.0.1.tgz","integrity":"sha512-zdj5ca8T5gmKNz6AZGP4iSbsMOk5LGYTdeKGmAPO5iYT2wEuVki8u3BA48gkwGvJrVjP8Rk/zkiBZEI8MIXkpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDYcVgAlTS7jGMI6LuWka8NwcktZwxCljp6UQMP9KfLAgIgdcbjKgr3CR+PpznFvU70ARbOCC3MD0+8sWPoY90RsOg="}],"size":870,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.1.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":1406802898862,"_cnpm_publish_time":1406802898862,"dist-tags":{"latest":"2.1.0"}}