# is-node-process

> Reliably determines if the code is running in Node.js

Latest version **1.2.0** (published 2023-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-node-process
pnpm add is-node-process
yarn add is-node-process
bun add is-node-process
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-03-23 |
| First published | 2021-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Maintainers | kettanaito |

## Links

- npm: https://www.npmjs.com/package/is-node-process
- Repository: https://github.com/mswjs/is-node-process
- Homepage: https://github.com/mswjs/is-node-process#readme
- Issues: https://github.com/mswjs/is-node-process/issues
- npm.io page: https://npm.io/package/is-node-process

## Recent versions

- 1.2.0 (latest) — 2023-03-23
- 1.1.0 — 2023-03-23
- 1.0.1 — 2021-07-23
- 1.0.0 — 2021-07-19

## README

[![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
```

---
_Source: https://npm.io/package/is-node-process · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
