uinz-require-dir
v1.0.6
Published
require dir
Downloads
4
Readme
uinz-require-dir
npm i uinz-require-dir --save
how to use
requireDir(dirPath[, iAmIndex ])
example dir
foo
|- foo-a.js
|- foo-b.js
`- bar
|- index.js
|- bar-a.js
`- bar-b.js
const requireDir = require('uinz-require-dir')
const result = requireDir('./foo')
// result = {
// fooA: require('./foo/foo-a.js'),
// fooB: require('./foo/foo-b.js'),
// bar: require('./bar/index.js') // due to bar has index.js
// }
if you use it in index.js
const result = requireDir('./foo', true)
TODO
不知道怎么处理 requireDir('./') 的使用方式 暂时只能 requireDir(__dirname) 的方式 path 应该怎么用呢?