HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/design.system/node_modules/is-node-process/README.md
[![Package version](https://img.shields.io/npm/v/is-node-process.svg)](https://www.npmjs.com/package/is-node-process)

# `is-node-process`

Reliably determines if the code is running in Node.js

## Motivation

This library was created to provide a reliable way of determining a Node.js process, taking into account:

- Browser-like environments (JSDOM);
- Electron renderer process;
- React Native runtime.

### Why relying on `window` is a bad idea

There are environments (i.e. JSDOM) that polyfill the global `window` object and some of its API for the sake of emulating browser-like behaviors, while still remaining a Node.js process.

### Why relying on `process` is a bad idea

Electron injects a global `process` object in the browser runtime when run with the `nodeIntegration: true` option.

## Getting started

```sh
$ npm install is-node-process
# or
$ yarn add is-node-process
```

```js
// any/code.js
const { isNodeProcess } = require('is-node-process')
isNodeProcess() // true/false
```