Socket
Socket
Sign inDemoInstall

which

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

which - npm Package Compare versions

Comparing version 1.0.3 to 1.0.5

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
"version": "1.0.3",
"version": "1.0.5",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -30,4 +30,6 @@ module.exports = which

function which (cmd, cb) {
if (cmd.charAt(0) === "/") return cb(null, cmd)
if (isAbsolute(cmd)) return cb(null, cmd)
var pathEnv = (process.env.PATH || "").split(COLON)

@@ -38,2 +40,3 @@ , pathExt = [""]

pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
if (cmd.indexOf(".") !== -1) pathExt.unshift("")
}

@@ -62,5 +65,4 @@ //console.error("pathEnv", pathEnv)

function whichSync (cmd) {
if (cmd.charAt(0) === "/") return cmd
if (isAbsolute(cmd)) return cmd
var pathEnv = (process.env.PATH || "").split(COLON)

@@ -71,2 +73,3 @@ , pathExt = [""]

pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
if (cmd.indexOf(".") !== -1) pathExt.unshift("")
}

@@ -86,1 +89,21 @@ for (var i = 0, l = pathEnv.length; i < l; i ++) {

}
var isAbsolute = process.platform === "win32" ? absWin : absUnix
function absWin (p) {
if (absUnix(p)) return true
// pull off the device/UNC bit from a windows path.
// from node's lib/path.js
var splitDeviceRe =
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/
, result = splitDeviceRe.exec(p)
, device = result[1] || ''
, isUnc = device && device.charAt(1) !== ':'
, isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
return isAbsolute
}
function absUnix (p) {
return p.charAt(0) === "/" || p === ""
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc