npm.io
4.0.1 • Published 4 years ago

peck

Licence
ISC
Version
4.0.1
Deps
3
Size
6 kB
Vulns
0
Weekly
0
Stars
1

peck Build Status

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. Optional
  • exclude - Array or string of specific files to exclude. Optional

Keywords