8000 GitHub - dominicbarnes/each-module: Execute a function on each module in a directory · GitHub
[go: up one dir, main page]

Skip to content

About

Execute a function on each module in a directory

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

EachModule

Execute a function on each module in a directory.

Current Version: 1.0. 7152 0
Node Support: 0.10.x, 0.11.x
License: MIT
Build Status: Build Status

eachModule('./examples', function (name, mod) {
    // name = the name of the loaded module
    // mod  = the module's exports
});

Install

Install EachModule with npm:

npm install each-module

Usage

// Load EachModule
var eachModule = require('each-module');

// Find/load all JavaScript/CoffeeScript modules
// in the `examples` folder
eachModule('./examples', function (name, mod) {
    // This function is run for each module:
    // name = the name of the loaded module
    // mod  = the module's exports
});

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 check that everything works by running the following before opening a pull-request:

make lint test

License

EachModule is licensed under the MIT license.
Copyright © 2014, Rowan Manning

About

Execute a function on each module in a directory

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0