1.0.6 • Published 10 years ago

et-al v1.0.6

Weekly downloads
11
License
Artistic-2.0
Repository
github
Last release
10 years ago

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:

  • my-app.js
  • models/
    • index.js
    • foo.js
    • bar.js

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

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago