{"_id":"detect-node","_rev":"74982","name":"detect-node","description":"Detect Node.JS (as opposite to browser environment) (reliable)","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"time":{"modified":"2021-06-03T10:24:21.000Z","created":"2014-07-31T10:20:21.252Z","2.1.0":"2021-05-16T06:34:44.130Z","2.0.5":"2021-03-16T18:53:49.576Z","2.0.4":"2018-08-31T15:52:23.291Z","2.0.3":"2014-08-01T16:28:40.851Z","2.0.2":"2014-07-31T10:36:39.833Z","2.0.1":"2014-07-31T10:34:58.862Z","2.0.0":"2014-07-31T10:30:55.255Z","1.0.0":"2014-07-31T10:20:21.252Z"},"users":{"xch":true,"i-erokhin":true,"cliff":true},"author":{"name":"Ilya Kantor"},"repository":{"type":"git","url":"git+https://github.com/iliakan/detect-node.git"},"versions":{"2.1.0":{"name":"detect-node","version":"2.1.0","description":"Detect Node.JS (as opposite to browser environment) (reliable)","main":"index.js","module":"index.esm.js","browser":"browser.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/iliakan/detect-node.git"},"keywords":["detect","node"],"author":{"name":"Ilya Kantor"},"license":"MIT","bugs":{"url":"https://github.com/iliakan/detect-node/issues"},"homepage":"https://github.com/iliakan/detect-node","gitHead":"00381fd0fdbdefa625ac7b8230adfc1df11d49ad","_id":"detect-node@2.1.0","_nodeVersion":"16.1.0","_npmVersion":"7.12.0","dist":{"shasum":"c9c70775a49c3d03bc2c06d9a73be550f978f8b1","size":1609,"noattachment":false,"key":"/detect-node/-/detect-node-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.1.0.tgz"},"_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"directories":{},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-node_2.1.0_1621146884014_0.30255741347595166"},"_hasShrinkwrap":false,"publish_time":1621146884130,"_cnpm_publish_time":1621146884130},"2.0.5":{"name":"detect-node","version":"2.0.5","description":"Detect Node.JS (as opposite to browser environment) (reliable)","main":"index.js","browser":"browser.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/iliakan/detect-node.git"},"keywords":["detect","node"],"author":{"name":"Ilya Kantor"},"license":"MIT","bugs":{"url":"https://github.com/iliakan/detect-node/issues"},"homepage":"https://github.com/iliakan/detect-node","gitHead":"5055d28c8eb98fcc7fdb762dc280a88d05784c28","_id":"detect-node@2.0.5","_nodeVersion":"15.7.0","_npmVersion":"6.14.5","dist":{"shasum":"9d270aa7eaa5af0b72c4c9d9b814e7f4ce738b79","size":1578,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.0.5.tgz"},"_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"directories":{},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-node_2.0.5_1615920829418_0.8787741762510632"},"_hasShrinkwrap":false,"publish_time":1615920829576,"_cnpm_publish_time":1615920829576},"2.0.4":{"name":"detect-node","version":"2.0.4","description":"Detect Node.JS (as opposite to browser environment) (reliable)","main":"index.js","browser":"browser.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/iliakan/detect-node.git"},"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":"563e0b838ec1dd9b169d843268cdb220b78ddd91","_id":"detect-node@2.0.4","_npmVersion":"6.4.0","_nodeVersion":"10.9.0","_npmUser":{"name":"iliakan","email":"iliakan@gmail.com"},"dist":{"shasum":"014ee8f8f669c5c58023da64b8179c083a28c46c","size":1580,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.0.4.tgz"},"maintainers":[{"name":"iliakan","email":"iliakan@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-node_2.0.4_1535730743130_0.9044559921683464"},"_hasShrinkwrap":false,"publish_time":1535730743291,"_cnpm_publish_time":1535730743291},"2.0.3":{"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","size":844,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.0.3.tgz"},"directories":{},"publish_time":1406910520851,"_cnpm_publish_time":1406910520851,"_hasShrinkwrap":false},"2.0.2":{"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","size":868,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.0.2.tgz"},"directories":{},"publish_time":1406802999833,"_cnpm_publish_time":1406802999833,"_hasShrinkwrap":false},"2.0.1":{"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","size":870,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.0.1.tgz"},"directories":{},"publish_time":1406802898862,"_cnpm_publish_time":1406802898862,"_hasShrinkwrap":false},"2.0.0":{"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","size":804,"noattachment":false,"key":"/detect-node/-/detect-node-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-2.0.0.tgz"},"directories":{},"publish_time":1406802655255,"_cnpm_publish_time":1406802655255,"_hasShrinkwrap":false},"1.0.0":{"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","size":654,"noattachment":false,"key":"/detect-node/-/detect-node-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-node/download/detect-node-1.0.0.tgz"},"directories":{},"publish_time":1406802021252,"_cnpm_publish_time":1406802021252,"_hasShrinkwrap":false}},"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","_attachments":{},"homepage":"https://github.com/iliakan/detect-node","bugs":{"url":"https://github.com/iliakan/detect-node/issues"},"license":"MIT"}