require-all / 1.1.0 last updated 3 months ago created on Dec 14th 2011
Install
npm install --save require-all
Clone
git clone git@github.com:felixge/node-require-all.git
dependencies
No dependencies listed.
maintainers
versions
9 total
| 1.1.0 | 3 months ago | dougwilson |
| 1.0.0 | 9 months ago | dougwilson |
| 0.0.8 | 2 years ago | dscape |
| 0.0.6 | 2 years ago | thlorenz |
| 0.0.5 | 3 years ago | thlorenz |
| 0.0.4 | 3 years ago | felixge |
| 0.0.3 | 4 years ago | felixge |
| 0.0.2 | 4 years ago | felixge |
| 0.0.1 | 4 years ago | felixge |
readme
require-all
An easy way to require all files within a directory.
Usage
Advanced usage
If your objective is to simply require all .js and .json files in a directory you can just pass a string to require-all:
Constructed object usage
If your directory contains files that all export constructors, you can require them all and automatically construct the objects using resolve:
Alternative property names
If your directory contains files where the names do not match what you want in the resulting property (for example, you want camelCase but the file names are snake_case), then you can use the map function: