directory

require everything in a directory

directory

require all files and directories inside a directory synchronously

Any of the below

 
// return an object hash 
var dir = require('directory')
 
// or pass a callback 
require('directory')(function (modulename) {
  exports[name] = module
})
 
// or pass a different path 
var dir = require('directory')(__dirname +'/../plugins/')
 
// or pass both 
var dir = require('directory')(__dirname +'/plugins/', function (modulename) {
  exports[name] = module
})
 

npm install directory

require('directory')([dirname, iterator])

npm install mocha -g and make test

MIT