4.0.1 • Published 2 years ago

peck v4.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
2 years ago

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
4.0.1

2 years ago

4.0.0

2 years ago

3.0.1

5 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.0.4

8 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago