Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

indexport

h2non2.7kMIT0.1.1

index.js made DRYer. Exports all the modules in a directory in just one sentence

export, index.js, index, root, module, modules, public, alias, dry

readme

indexport Build Status

Node's index.js modules made DRYer. Just export all the modules in a directory in one sentence.

Not clear enough? Ok, let me give you an example:

Instead of writting the following index.js file:

module.exports = {
  moduleA: require('./module-a'),
  moduleB: require('./module-b'),
  moduleC: require('./module-c'),
  moduleD: require('./module-d'),
  ...
}

With indexport you can do:

module.exports = require('indexport')(__dirname)

Conclusion: the exported interface are exactly the same.

Installation

npm install indexport --save

Usage

In your index.js JS file:

module.exports = require('indexport')(__dirname)

API

indexport(directory) => object

Returns an object map with the exported modules.

License

MIT - Tomas Aparicio