Skip to content

solon/import-all

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

import-all

Given the path to a directory containing JavaScript files, returns an array of all of their default exports.

import importAll from 'import-all';
const imports = importAll(`${__dirname}/directory`);

Alternatively, by passing an optional asObject = true parameter, it returns an object with module names as keys.

import importAll from 'import-all';
const imports = importAll(`${__dirname}/directory`, true);

About

Given the path to a directory containing ES6 modules, requires all of their default exports and returns them as an object

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%