1 | # Description
|
2 |
|
3 | Write minimal node index.js/index.coffee files that require and export all their siblings by file basename
|
4 |
|
5 | # Installation
|
6 | ```
|
7 | npm install requireindex
|
8 | ```
|
9 |
|
10 | # Usage
|
11 | Check the test directory for example usage. The directory tree looks like:
|
12 |
|
13 | ```
|
14 | -lib/
|
15 | -index.js
|
16 | -Foo.js
|
17 | -bar/
|
18 | index.js
|
19 | f.js
|
20 | fing.js
|
21 | -bam.js
|
22 | ```
|
23 |
|
24 | The index.js files look like this:
|
25 |
|
26 | ```js
|
27 | module.exports = require('requireindex')(__dirname)
|
28 | ```
|
29 |
|
30 | and the result of
|
31 |
|
32 | ```
|
33 | require('lib')
|
34 | ```
|
35 |
|
36 | is this:
|
37 |
|
38 | ```
|
39 | {
|
40 | bam: {
|
41 | m: [Function]
|
42 | },
|
43 | bar: {
|
44 | f: [Function],
|
45 | fing: [Function]
|
46 | },
|
47 | Foo: {
|
48 | l: [Function],
|
49 | ls: [Function]
|
50 | }
|
51 | }
|
52 | ```
|