https://github.com/h2non/indexport
Node's index.js made DRYer. Exports all the modules in a directory in just one sentence
https://github.com/h2non/indexport
Last synced: 5 months ago
JSON representation
Node's index.js made DRYer. Exports all the modules in a directory in just one sentence
- Host: GitHub
- URL: https://github.com/h2non/indexport
- Owner: h2non
- License: mit
- Created: 2015-10-29T19:15:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-29T21:04:16.000Z (over 9 years ago)
- Last Synced: 2025-01-16T20:16:39.041Z (5 months ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# indexport [](https://travis-ci.org/h2non/indexport)
Node's `index.js` modules made DRYer. Just export all the modules in a directory in one sentence.
Not clear enough? Ok, let me give you an example:
Instead of writting the following `index.js` file:
```js
module.exports = {
moduleA: require('./module-a'),
moduleB: require('./module-b'),
moduleC: require('./module-c'),
moduleD: require('./module-d'),
...
}
```With `indexport` you can do:
```js
module.exports = require('indexport')(__dirname)
```Conclusion: the exported interface are exactly the same.
## Installation
```js
npm install indexport --save
```## Usage
In your `index.js` JS file:
```js
module.exports = require('indexport')(__dirname)
```## API
### indexport(directory) => `object`
Returns an object map with the exported modules.
## License
MIT - Tomas Aparicio