node-require-directory icon indicating copy to clipboard operation
node-require-directory copied to clipboard

Avoid passing module as the first argument or make it optional

Open davebaol opened this issue 8 years ago • 1 comments

What about using parent-module or directly callsites to avoid the need of passing module as the first argument?

davebaol avatar May 07 '16 13:05 davebaol

Currently to achieve this result I have to use a proxy module like that

var requireDirectory = require('require-directory');
var parentModule = require('parent-module');

module.exports = function(path, options) {
  return requireDirectory(require.cache[parentModule()], path, options);
}

It would be nice to have this feature supported directly.

davebaol avatar May 07 '16 15:05 davebaol