peck

4.0.1 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.1
    0
    • latest

Version History

Package Sidebar

Install

npm i peck

Weekly Downloads

0

Version

4.0.1

License

ISC

Unpacked Size

6.59 kB

Total Files

11

Last publish

Collaborators

  • danielb