$ npm install is-npm-cli
Check if your code is running as an npm script
npm install --global is-npm-cli
$ is-npm --help Usage $ is-npm Exits with code 0 if running as an npm script, otherwise code 2