Licence
MIT
Version
1.0.0
Deps
2
Vulns
0
Weekly
0
@nhz.io/autoindex
Autoindex directory (require) with custom loaderInstall
npm i -S @nhz.io/autoindex
Usage
const ai = require('@nhz.io/autoindex')
module.exports = ai(__dirname, glob, loader)
...
Example
/** +-+
* +- index.js
* +- a.js
* +- b.js
*/
// File: index.js
const ai = require('@nhz.io/autoindex')
module.exports = ai(__dirname) // a.js and b.js are autorequired and exported
Notes
glob and loader are optional
- Default
glob is: *.+(js|json)
- Default loader will skip
index.* files
- Custom
loader will receive the path of the matching module as a first argument
License
MIT
Install
npm i -S @nhz.io/autoindex
Usage
const ai = require('@nhz.io/autoindex')
module.exports = ai(__dirname, glob, loader)
...
Example
/** +-+
* +- index.js
* +- a.js
* +- b.js
*/
// File: index.js
const ai = require('@nhz.io/autoindex')
module.exports = ai(__dirname) // a.js and b.js are autorequired and exported
Notes
globandloaderare optional- Default
globis:*.+(js|json) - Default loader will skip
index.*files - Custom
loaderwill receive the path of the matching module as a first argument