require-dir-as-map

Require a directory as a new Map()


Keywords
module, nodejs, require
License
MIT
Install
npm install require-dir-as-map@1.0.0

Documentation

require-dir-as-map

Build Status npm version

Require a directory and get back a new Map()

Usage

const requireDirAsMap = require('require-dir-as-map');


const filter = (file) => {
  return file;
};

const map = ({ file, module }) => {
  return module.somethingThere || file.split('.')[0];
}

requireDirAsMap('/my-directory/', { filter, map });

License

Licensed under The MIT License Redistributions of files must retain the above copyright notice.

Author

Vinícius Krolow - krolow[at]gmail.com