Socket
Socket
Sign inDemoInstall

detect-node

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

2

index.js

@@ -1,1 +0,1 @@

module.exports = (typeof process === 'object') && Object.prototype.toString.call(process) === '[object process]' ? true : false;
module.exports = Object.prototype.toString.call( (global || window).process ) === '[object process]' ? true : false;
{
"name": "detect-node",
"version": "1.0.0",
"version": "2.0.0",
"description": "Detect Node.JS (as opposite to browser environment) (reliable)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,1 +12,10 @@ Usage:

The check is performed as:
```js
module.exports =
Object.prototype.toString.call( (global || window).process ) === '[object process]' ?
true : false;
```
Thanks 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 causes browserify to include it into the build.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc