multiwhich

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i multiwhich

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn