npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

whech

v0.7.6

Published

which the heck directions

Downloads

31

Readme

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