Socket
Socket
Sign inDemoInstall

which

Package Overview
Dependencies
1
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 3.0.0

bin/which.js

45

package.json
{
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"author": "GitHub Inc.",
"name": "which",
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
"version": "2.0.2",
"version": "3.0.0",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-which.git"
"url": "https://github.com/npm/node-which.git"
},
"main": "which.js",
"main": "lib/index.js",
"bin": {
"node-which": "./bin/node-which"
"node-which": "./bin/which.js"
},

@@ -19,26 +19,33 @@ "license": "ISC",

"devDependencies": {
"mkdirp": "^0.5.0",
"rimraf": "^2.6.2",
"tap": "^14.6.9"
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.8.0",
"tap": "^16.3.0"
},
"scripts": {
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublish": "npm run changelog",
"prechangelog": "bash gen-changelog.sh",
"changelog": "git add CHANGELOG.md",
"postchangelog": "git commit -m 'update changelog - '${npm_package_version}",
"postpublish": "git push origin --follow-tags"
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"posttest": "npm run lint"
},
"files": [
"which.js",
"bin/node-which"
"bin/",
"lib/"
],
"tap": {
"check-coverage": true
"check-coverage": true,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
},
"engines": {
"node": ">= 8"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.8.0"
}
}

@@ -12,26 +12,20 @@ # which

```javascript
var which = require('which')
const which = require('which')
// async usage
which('node', function (er, resolvedPath) {
// er is returned if no "node" is found on the PATH
// if it is found, then the absolute path to the exec is returned
})
// rejects if not found
const resolved = await which('node')
// or promise
which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... })
// if nothrow option is used, returns null if not found
const resolvedOrNull = await which('node', { nothrow: true })
// sync usage
// throws if not found
var resolved = which.sync('node')
const resolved = which.sync('node')
// if nothrow option is used, returns null if not found
resolved = which.sync('node', {nothrow: true})
const resolvedOrNull = which.sync('node', { nothrow: true })
// Pass options to override the PATH and PATHEXT environment vars.
which('node', { path: someOtherPath }, function (er, resolved) {
if (er)
throw er
console.log('found at %j', resolved)
})
await which('node', { path: someOtherPath, pathExt: somePathExt })
```

@@ -38,0 +32,0 @@

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