Skip to content

sithmel/require-many

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

require-node-glob

Yet another require-all variant. Sadly I didn't find one that:

  • works for relative/absolute urls
  • works for modules
  • returning an array

Import an array of node modules, using globbing and require.resolve.

const requireGlob = require('require-node-glob');

const locals = requireGlob('./services/*.js'); // if you start with ./ they are local modules

const abs = requireGlob('/home/sithmel/services/*.js'); // if you start with / they are absolute urls

const decorators = requireGlob('async-deco/src/*.js'); // in this case it will resolve from the package "async-deco"

const decorators = requireGlob(['./services/*.js', 'module1/services/*.js']); // you can use an array to include multiple globs

About

Import an array of node modules, using globbing and require.resolve.

Resources

License

Stars

Watchers

Forks

Packages

No packages published