JSPM

multiwhich

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q26545F
  • License MIT

Find the paths of multiple executables in the PATH

Package Exports

  • multiwhich

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (multiwhich) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

multiwhich

NPM version Build Status Build status Coverage Status Dependency Status devDependency Status

node-which with multi-executable support: finds the first instance of a specified executable in the PATH environment variable.

const multiwhich = require('multiwhich');

multiwhich(['ls', 'mkdir'], (err, paths) {
  if (err) {
    throw err;
  }

  paths; ['/bin/ls', '/bin/mkdir']
});

Installation

Use npm.

npm install multiwhich

API

const multiwhich = require('multiwhich');

multiwhich(cmds [, options], callback)

cmds: Array of strings
options: Object (used as node-which options)
callback: Function

The API is almost the same as node-which's, except for:

  • It receives an array of executable names as its first argument.
  • It passes an array of the resolved executable paths to the callback function.
const multiwhich = require('multiwhich');

multiwhich(['eslint', 'tape'], {path: 'node_modules/.bin/'}, (err, paths) => {
  if (err) {
    throw err;
  }

  paths:
  //=> ['/Users/yourname/project/node_modules/.bin/eslint', '/Users/yourname/project/node_modules/.bin/eslint']
});

License

Copyright (c) 2015 Shinnosuke Watanabe

Licensed under the MIT License.