0.3.1 • Published 10 years ago

root-require v0.3.1

Weekly downloads
10,809
License
-
Repository
github
Last release
10 years ago

root-require

Usage

Just once:

var Sails = require('root-require')('lib/app');

More than once:

var rootRequire = require('root-require');

var Sails = rootRequire('lib/app');
var Router = rootRequire('lib/router');
var MiddlewareLibrary = rootRequire('lib/middleware');

Purpose

a more convenient require method for certain situations.

How it do

This lets you require() using a relative path from the root directory of the present module.

Credit where credit is due

This is mainly a thin wrapper around packpath (https://github.com/jprichardson/node-packpath)-- this module just exists so we can do it in one line.

License

MIT, c. 2014 Mike McNeil