peck
v4.0.1
Published
requires multiple modules
Downloads
5
Readme
peck
Require multiple files in a directory
Peck(dirname, [options])
Peck reads in a directory and transform all files into camelCase based on filename rules using proper underscores. hello_world.js, and hello-world.js become helloWorld.
For a directory controllers containing a filename status.js among others:
var Controllers = Peck(__dirname + '/controllers');
hapiServer.route({
path: '/generate-categories/status',
method: 'GET',
config: Controllers.status
});
note that if you have a structure such as controllers/users/login.js
and
controllers/users.js
which has a module.exports.logout function, the
respective objects will be merged to contain both a login and a logout function.
If the users.js has modules.exports = []
the array will completely be ignored
since objects can't merge with arrays.
Options
Where options is an object with the following properties:
include
- Array or string of specific files to include. Optionalexclude
- Array or string of specific files to exclude. Optional