each-module
v2.0.0EachModule
Execute a function on each module in a directory.
eachModule('./examples', function (name, mod, file) {
// name = the name of the loaded module
// mod = the module's exports
// file = the absolute path of the loaded module
});
Table of Contents
Requirements
EachModule requires the following to run:
Usage
Install EachModule with npm:
npm install each-module
Use EachModule like this:
// Load EachModule
var eachModule = require('each-module');
// Find/load all JavaScript/CoffeeScript modules
// in the `examples` folder
eachModule('./examples', function (name, mod, file) {
// This function is run for each module:
// name = the name of the loaded module
// mod = the module's exports
// file = the absolute path of the loaded module
});
Note: EachModule loads modules synchronously only, so it's best used in your application's startup – it's blocking.
Contributing
To contribute to EachModule, clone this repo locally and commit your code on a separate branch. Please write unit tests for your code, and run the linter before opening a pull-request:
make test # run all tests
make verify # run all linters
Support and Migration
EachModule major versions are normally supported for 6 months after their last minor release. This means that patch-level changes will be added and bugs will be fixed. The table below outlines the end-of-support dates for major versions, and the last minor release for that version.
We also maintain a migration guide to help you migrate.
:grey_question: | Major Version | Last Minor Release | Node.js Versions | Support End Date |
---|---|---|---|---|
:heart: | 2 | N/A | 4+ | N/A |
:hourglass: | 1 | 1.2 | 0.10–6 | 2018-07-08 |
If you're opening issues related to these, please mention the version that the issue relates to.
License
EachModule is licensed under the MIT license.
Copyright © 2014–2017, Rowan Manning