which
Advanced tools
Comparing version 2.0.2 to 3.0.0
{ | ||
"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 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
134
2
7179
5
49
2