codebase module search


locate used modules

npm install -g jut

jut -m badmodule

or use it with jung and a test runner!

jung -f '\.js$' -- test_runner $(ls tests/**/*.js | jut -m '$JUNG_FILE' -Fnj)

or something else. the world is yours.

jut [options] --module <modulename>

Options are:

  • --module, -m <modulename> Find files that require <modulename>
  • --dir, -d <dirname> Search files in <dirname> recursively
  • --file, -f <filename> Search <filename> for modules
  • --justmatch, -j Just print the filename that matches
  • --fullpath, -F Print full path to matched file
  • --require, -r <name> Specify a different function name from require
  • --nocolor, -n Don't colorize results
  • --version, -v Print current version
  • --help, -h Print help

in order to support searching for "deep-requires", (such as module-name/sub-module) searching for a "local" file (such as ../../module-name/sub-module) requires a leading ./ in the module name.

jut(['array', 'of', 'module', './names'], ['aliases']) -> DuplexStream

stream it filenames, and get out objects with match objects. something like:

var jut = require('jut')
  , ls = require('ls-stream') // for example 
  , convert = require('dotpath-stream')
  , filter = require('stream-police')
  .pipe(convert('path')) // reduce ls-stream object to path string 
  .pipe(filter(function(data) {
    return /\.js$/.test(data.toString()) // only js files 
  .pipe(jut(['falafel'])) // right over to jut 
  .on('data', function(data) {
    console.log(data) // {filename: fullpath, line: lineNumber, module: 'falafel'}