include-all
An easy way to include all node.js modules within a directory.
This is a fork of felixge's awesome module, require-all (https://github.com/felixge/node-require-all) which adds a few extra capabilities:
- the ability to
include-all
a directory as optional. - the ability to filter by path, not just filename (pathFilter)
Usage
var controllers = require('include-all')({
dirname : __dirname + '/controllers',
filter : /(.+Controller)\.js$/,
excludeDirs : /^\.(git|svn)$/
});
### Optional include
var models = require('include-all')({
dirname : __dirname + '/models',
filter : /(.+)\.js$/,
excludeDirs : /^\.(git|svn)$/,
optional : true
});
Filter by filepath
var models = require('include-all')({
dirname : __dirname + '/controllers',
filterPath : /(.+)/(.+).js$/,
excludeDirs : /^.(git|svn)$/
});