import fs from 'fs';
import path from 'path';
import walk from 'walk-sync';

export default function requireDir(dirpath) {
  let modules = {};
  walk(dirpath).forEach((filepath) => {
    let absolutepath = path.join(dirpath, filepath);
    if (fs.statSync(absolutepath).isFile() && /\.js$/.test(filepath)) {
      let moduleName = filepath.slice(0, filepath.length - 3);
      modules[moduleName] = require(absolutepath);
    }
  });
  return modules;
}

@@ -112,16 +112,30 @@
 (dirpath
+, options = %7B%7D
 ) %7B%0A  le
@@ -156,21 +156,140 @@
 ;%0A  
-walk(dirpath)
+let paths;%0A  if (options.recurse === false) %7B%0A    paths = fs.readdirSync(dirpath);%0A  %7D else %7B%0A    paths = walk(dirpath);%0A  %7D%0A  paths
 .for

add recursive option to require-dir