0.1.1 • Published 11 years ago

toplevel v0.1.1

Weekly downloads
14
License
-
Repository
github
Last release
11 years ago

Toplevel

Toplevel is a super simple node module that wraps the built-in require() and lets you require your code relative to a top level directory rather than relative to the current file.

How it works

Create an empty Top file in the top level directory of your code.

$ touch Toplevel
$ tree -I node_modules .
.
├── app.js
├── lib
│   └── example.js
├── package.json
├── test
│   └── example_test.js
└── Top

Now any code in subdirectories like lib or test can use topl to require modules relative to the Top file.

test/example_tests.js:

var requireFromTop = require('toplevel')(__dirname)
   ,example = requireFromTop('lib/example');
...
0.1.1

11 years ago

0.1.0

11 years ago

0.0.1

11 years ago