/usr/local/lib/node_modules/nodemon/node_modules/is-npm
Edit: /usr/local/lib/node_modules/nodemon/node_modules/is-npm/readme.md (2087B)
# is-npm [](https://travis-ci.com/sindresorhus/is-npm)
> Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) or [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script
## Install
```
$ npm install is-npm
```
## Usage
```js
const {isNpmOrYarn, isNpm, isYarn} = require('is-npm');
console.table({isNpmOrYarn, isNpm, isYarn});
```
```sh
$ node foo.js
# ┌─────────────┬────────┐
# │ (index) │ Values │
# ├─────────────┼────────┤
# │ isNpmOrYarn │ false │
# │ isNpm │ false │
# │ isYarn │ false │
# └─────────────┴────────┘
$ npm run foo
# ┌─────────────┬────────┐
# │ (index) │ Values │
# ├─────────────┼────────┤
# │ isNpmOrYarn │ true │
# │ isNpm │ true │
# │ isYarn │ false │
# └─────────────┴────────┘
$ yarn run foo
# ┌─────────────┬────────┐
# │ (index) │ Values │
# ├─────────────┼────────┤
# │ isNpmOrYarn │ true │
# │ isNpm │ false │
# │ isYarn │ true │
# └─────────────┴────────┘
```
## Related
- [is-npm-cli](https://github.com/sindresorhus/is-npm-cli) - CLI for this module
---