Socket
Socket
Sign inDemoInstall

is-npm

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 5.0.0

6

index.js
'use strict';
const packageJson = process.env.npm_package_json;
const userAgent = process.env.npm_config_user_agent;
const isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
const isNpm = Boolean(userAgent && userAgent.startsWith('npm'));
const isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json'));
module.exports.isNpmOrYarn = isNpm || isYarn;
module.exports.isNpm = isNpm;
module.exports.isNpmOrYarn = isNpm || isNpm7 || isYarn;
module.exports.isNpm = isNpm || isNpm7;
module.exports.isYarn = isYarn;
{
"name": "is-npm",
"version": "4.0.0",
"version": "5.0.0",
"description": "Check if your code is running as an npm script",
"license": "MIT",
"repository": "sindresorhus/is-npm",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd-check"
"test": "xo && ava && tsd"
},

@@ -24,2 +25,3 @@ "files": [

"npm",
"yarn",
"is",

@@ -35,5 +37,5 @@ "check",

"ava": "^2.4.0",
"tsd-check": "^0.6.0",
"xo": "^0.25.3"
"tsd": "^0.11.0",
"xo": "^0.30.0"
}
}

@@ -1,6 +0,5 @@

# is-npm [![Build Status](https://travis-ci.org/sindresorhus/is-npm.svg?branch=master)](https://travis-ci.org/sindresorhus/is-npm)
# is-npm [![Build Status](https://travis-ci.com/sindresorhus/is-npm.svg?branch=master)](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

@@ -12,3 +11,2 @@

## Usage

@@ -49,3 +47,6 @@

## Related
- [is-npm-cli](https://github.com/sindresorhus/is-npm-cli) - CLI for this module
---

@@ -52,0 +53,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc