if-npm
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

if-npm

  • Check if your code is running as an npm or yarn script

Install

  • You must install the package on your project
npm install if-npm

Usage

import {isNpmOrYarn, isNpm, isYarn} from 'if-npm';

console.table({isNpmOrYarn, isNpm, isYarn});
$ node kar.js
# ┌─────────────┬────────┐
# │   (index)   │ Values │
# ├─────────────┼────────┤
# │ isNpmOrYarn │ false  │
# │    isNpm    │ false  │
# │   isYarn    │ false  │
# └─────────────┴────────┘
$ npm run kar
# ┌─────────────┬────────┐
# │   (index)   │ Values │
# ├─────────────┼────────┤
# │ isNpmOrYarn │  true  │
# │    isNpm    │  true  │
# │   isYarn    │ false  │
# └─────────────┴────────┘
$ yarn run kar
# ┌─────────────┬────────┐
# │   (index)   │ Values │
# ├─────────────┼────────┤
# │ isNpmOrYarn │  true  │
# │    isNpm    │ false  │
# │   isYarn    │  true  │
# └─────────────┴────────┘

Contact

  • Contact With Me Discord : Karlos#4123

Package Sidebar

Install

npm i if-npm

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

3.69 kB

Total Files

5

Last publish

Collaborators

  • dr-karlos