1.0.0 • Published 7 years ago

getem v1.0.0

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

getem

Build Status

A module allows you get all the files withing a directory. Inpired by node-require-all .

Installation

npm install getem

Usage

const directory = `${__dirname}/some/path`; // or an options object
const modules = require('getem')(directory);

Options

Options can be a string of the path. Or a configuration object.

keydefaultdescription
dirnamenullThe directory where file are going to be required from
recursivetrueWhether or not to recurse when encoutering a directory
require_indexestrueWhen true if a directory is encountered it will try to require it
excludeDir/^[^\.]/RegEx or Function - it must return falsy value. By default it will exclude hidden folders
filterFile/^([^\.].*)\.js(on)?$/RegEx or Function - it must return falsy value. By default it will exclude hidden files
map(val) => valAllows you to modify the name of the key to be inserted as the module refer

Licence

MIT