# is-global

> Checks whether Node.js is running a global module

Latest version **0.1.0** (published 2014-01-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-global
pnpm add is-global
yarn add is-global
bun add is-global
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-01-01 |
| First published | 2012-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gabriel Llamas |
| Maintainers | gagle |
| Keywords | global, module |

## Links

- npm: https://www.npmjs.com/package/is-global
- Repository: https://github.com/gagle/node-is-global
- Issues: https://github.com/gagle/node-is-global/issues
- npm.io page: https://npm.io/package/is-global

## Recent versions

- 0.1.0 (latest) — 2014-01-01
- 0.0.2 — 2013-01-25
- 0.0.1 — 2012-12-04

## README

is-global
=========

#### Checks whether Node.js is running a global module ####

[![NPM version](https://badge.fury.io/js/is-global.png)](http://badge.fury.io/js/is-global "Fury Version Badge")

[![NPM installation](https://nodei.co/npm/is-global.png?mini=true)](https://nodei.co/npm/is-global "NodeICO Badge")

There are times that you need to know whether Node.js is executing a global module, typically when you're writing a third-party module and want to execute different pieces of code depending on the current context; local or global module.

On Windows the `PATH` environment variable is read to check the context. Node.js scripts running inside the npm install directory will always return true, eg:

```
cd C:\Users\<user>\AppData\Roaming\npm
node app.js
```

Therefore, don't run scripts from inside the npm install directory. No one does that so you can assume that on Windows platform it detects the global module execution correctly.

#### Functions ####

- [_module_() : Boolean](#isGlobal)

---

<a name="isGlobal"></a>
___module_() : Boolean__

Returns true if Node.js is executing a global module, otherwise false.

```javascript
var isGlobal = require ("is-global");
if (isGlobal ()){
  ...
}else{
  ...
}
```

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