UNPKG

655 BMarkdownView Raw
1# Description
2
3Write minimal node index.js/index.coffee files that require and export all their siblings by file basename
4
5# Installation
6```
7npm install requireindex
8```
9
10# Usage
11Check 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
24The index.js files look like this:
25
26```js
27module.exports = require('requireindex')(__dirname)
28```
29
30and the result of
31
32```
33require('lib')
34```
35
36is 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```