Get the names and paths of modules required in a given javascript module
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
tests
.gitignore
README.md
package.json

README.md

Get the names and paths of modules required in a given module:

> var required_as = require('./lib/required-as');
undefined
> required_as('tests/fixtures/module.js');
[ { name: 'net', source: 'net' },
  { name: 'self', source: './module.js' },
  { name: 'required_as',
    source: '../../lib/required-as.js' } ]

from the module:

var net = require('net');
var self = require('./module.js');
var required_as = require('../../lib/required-as.js');

var not_a_module = 3;