JSPM

  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q51726F
  • License MIT

which the heck directions

Package Exports

  • whech

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 (whech) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

whech progressed.io

build NPM version

which the heck directions

Was the script run from a bin?
What is the main node_modulesdirectory?
There is some config file asociated to it?
What is the global node_modules directory?

install

$ npm install --save whech

usage

var whech = require('whech');

whech.packageFields = ['version'];

whech('which', function(err, cmd){
  if(err) throw err;
  console.log(cmd);
  // =>
  // { name: 'which',
  //   extension: '.js',
  //   which: '/usr/bin/which',
  //   runFromBin: false,
  //   configFile: [Error: not found],
  //   mainDir: '/home/jcm/code/whech/node_modules',
  //   globalDir: '/home/jcm/npm/lib/node_modules',
  //   cliPackage: { [Error: Cannot find module] code: 'MODULE_NOT_FOUND' },
  //   modulePackage: { version: '1.0.5' } }
});

documentation

whech(spec, callback)

The function returned by the package is asynchronous. To use the sync version do whench.sync

spec

type string or object

when the spec is a string it becomnes cmd.name when spec is an object overrides the properties of the return cmd

callback(err, cmd)

The callback is called when all is done with the last error in the first argument if there was one and the second the found cmd properties.

returns an object with the example properties

If a the property is not found an error instance will be that key value.

test

$ npm test

todo

  • Make better tests
  • Review and see if there is something missing

license

LICENSE