@cladeco/import-all

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

Usage no npm install needed!

<script type="module">
  import cladecoImportAll from 'https://cdn.skypack.dev/@cladeco/import-all';
</script>

README

import-all CircleCI

Given the path to a directory containing JavaScript files, returns an object containing all of their default and named exports with the module names as keys.

Installation

$ npm install --save @cladeco/import-all

Usage


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

Credits

Uses code from charlieschwabacher/import-all and sindresorhus/import-modules.