et-al
Easily require all modules in a sub-directory and return them in an array.
Usage
Of course:
npm install --save et-al
Now let's say you have a directory structure like this:
You want to be able to get all your models (excluding index.js) in my-app.js like this:
var models = require('./models');
// models now contains an array of the model modules
// i.e. [foo, bar]
models.forEach(function(model) {
// do something with it
});
All you have to do is put this line in models/index.js:
module.exports = require('et-al');
Voila!
Coming Soon
Recursive loading and configurable behavior