1 | # is-installed-globally [![Build Status](https://travis-ci.org/sindresorhus/is-installed-globally.svg?branch=master)](https://travis-ci.org/sindresorhus/is-installed-globally)
|
2 |
|
3 | > Check if your package was installed globally
|
4 |
|
5 | Can be useful if your CLI needs different behavior when installed globally and locally.
|
6 |
|
7 |
|
8 | ## Install
|
9 |
|
10 | ```
|
11 | $ npm install is-installed-globally
|
12 | ```
|
13 |
|
14 |
|
15 | ## Usage
|
16 |
|
17 | ```js
|
18 | const isInstalledGlobally = require('is-installed-globally');
|
19 |
|
20 | // With `npm install your-package`
|
21 | console.log(isInstalledGlobally);
|
22 | //=> false
|
23 |
|
24 | // With `npm install --global your-package`
|
25 | console.log(isInstalledGlobally);
|
26 | //=> true
|
27 | ```
|
28 |
|
29 |
|
30 | ## Related
|
31 |
|
32 | - [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module
|
33 | - [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
|
34 | - [global-dirs](https://github.com/sindresorhus/global-dirs) - Get the directory of globally installed packages and binaries
|
35 |
|
36 |
|
37 | ## License
|
38 |
|
39 | MIT © [Sindre Sorhus](https://sindresorhus.com)
|