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 

install - documentation - license
which the heck directions for
- Was the script run from a bin?
- There is some config file asociated to it?
- What is the main or/and global
node_modulesdirectory? - Get me some fields of their the local and global packages
install
$ npm install --save whechusage
var whech = require('whech');
whech.packageFields = ['version'];
whech('which', function(err, env){
if(err) throw err;
console.log(env);
// =>
// { name: 'which',
// which: '/usr/bin/which',
// runFromBin: false,
// configFile: [Error: not found],
// localDir: '/home/jcm/code/whech/node_modules',
// globalDir: '/home/jcm/npm/lib/node_modules',
// globalPackage: { [Error: Cannot find module] code: 'MODULE_NOT_FOUND' },
// localPackage: { version: '1.0.5' } }
});documentation
The module.exports a function
var whech = require('whech')which is asynchronous. To use the sync version take whech.sync.
whech
function whech(string|object spec, function callback)arguments
spectype string|object, when string becomensspec.namecallbackfunction to called with the last error if there was one
Errors are attached to spec properties instead of throwing.
spec properties
name: the name given as a string or object propertywhich: first instance of an executable in the PATHrunFromBin: wether or notprocess.argvcontainswhichconfigFile:configFileif given, orname+ file + '.js'.localDir: if wasn't given, the global dir where node_modules are installedglobalDir: if wasn't given, the local dir where node_modules are installedlocalPackage:require(path.join(name, 'package'))globalPackage:require(path.join(localDir, name, 'package'))
whech.sync
function whechSync(string|object spec)arguments
spec, type string|object, the same as the async version
returns
specwith same properties listed above
test
npm testtodo
- More tests
- Review and see if there is something missing