Skip to content

nhz-io/autoindex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@nhz.io/autoindex

NPM Version Bithound Status License Downloads

Autoindex directory (require) with custom loader

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

  • 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

About

Autoindex directory (require) with custom loader

Resources

License

Stars

Watchers

Forks

Packages

No packages published