Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-node

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-node

Detect Node.JS (as opposite to browser environment) (reliable)

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14M
decreased by-11.66%
Maintainers
1
Weekly downloads
 
Created

What is detect-node?

The detect-node npm package is a simple utility that allows developers to determine if their JavaScript code is running in a Node.js environment as opposed to a browser environment. This can be useful for writing isomorphic code that behaves differently depending on where it is executed.

What are detect-node's main functionalities?

Node.js environment detection

This feature allows the developer to check if the code is running in Node.js. The package exports a boolean value that is true if the environment is Node.js and false otherwise.

const isNode = require('detect-node');
if (isNode) {
  console.log('Running in Node.js');
} else {
  console.log('Running in the browser');
}

Other packages similar to detect-node

Keywords

FAQs

Package last updated on 16 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc