0.7.6 • Published 9 years ago

whech v0.7.6

Weekly downloads
34
License
MIT
Repository
github
Last release
9 years ago

whech buildNPM version

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

usage

var whech = require('whech');

whech.ext = '.js';

whech('which', function(err, spec){
  if(err) throw err;
  console.log(spec);
  // =>
  // { 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

  • spec type string or object with a name property that is a string
  • callback type function to be called with the last error and spec

Errors are attached to spec a property instead of throwing.

spec properties

  • ext type string, the extension of the configFile
  • name type string the name given as a string or object property
  • which type string first instance of an executable in the PATH
  • runFromBin type boolean, wether or not process.argv contains which
  • configFile type string, configFile if given
  • localDir type string, the global dir where node_modules are installed
  • globalDir: type string, the local dir where node_modules are installed
  • localPackage: require(path.join(name, 'package'))
  • globalPackage: require(path.join(localDir, name, 'package'))

defaults

  • configfile will default to name + 'file' + (spec.ext || '.js')

whech.sync

function whechSync(string|object spec)

arguments

  • spec, type string|object, the same as the async version

returns

  • spec with same properties listed above

install

With npm

 npm install whech

test

npm test

todo

  • More tests
  • Review and see if there is something missing

license

LICENSE

0.7.6

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.24

9 years ago

0.5.23

10 years ago

0.5.22

10 years ago

0.5.21

10 years ago

0.5.20

10 years ago

0.5.19

10 years ago

0.5.18

10 years ago

0.5.17

10 years ago

0.5.16

10 years ago

0.5.15

10 years ago

0.5.14

10 years ago

0.5.13

10 years ago

0.5.12

10 years ago

0.5.11

10 years ago

0.5.10

10 years ago

0.5.8

10 years ago

0.5.7

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.0

10 years ago