package
Require all files in a directory
npm install req-allGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
3.9 kB
Includes dependencies.
Require all files in a directory
This module is intentionally simple. Not interested in more features.
$ npm install --save req-all.
└── dir
├── foo-bar.js
└── baz-faz.jsconst reqAll = require('req-all');
const modules = reqAll('dir');
console.log(modules);
//=> {fooBar: [Function], bazFaz: [Function]}Type: string
Default: __dirname
Directory to require supported files in. Unless you've modified require.extensions, that means any .js, .json, .node files, in that order. Does not recurse. Ignores the caller file and files starting with . or _.
Type: Object
Type: boolean
Default: true
Convert dash-style names (foo-bar) to camel-case (fooBar).
MIT © Sindre Sorhus