{%= description %}
This was ported from [export-files], use that project if you only want to export a directory of JavaScript files and you want the fastest possible way to do it besides defining each file explicitly.
{%= include("install-npm", {save: true}) %}
Specify the directory with files to export (this is a required argument):
module.exports = require('export-files')(__dirname);
//=> {a: [function], b: [function], c: [function]}
module.exports = require('export-files')(dir, patterns, recurse, options, fn);
dir
{String}: (required) directory with files to export.patterns
{String|Array|RegExp}: (optional) glob patterns or regex for filtering filesrecurse
{Boolean|Object}: (optional) or options. Whentrue
reads directories recursivly. Default isfalse
.options
{Object}: (optional) options for filtering, reading, and recursion.read
{Function}: function for reading or requiring filesrenameKey
{Function}: function for naming keys on the returned objectfilter
{Function}: function for filtering files
fn
{Function}: (optional) pass a custom reader function.
Filter and require only .json
files:
module.exports = require('export-files')(__dirname, '**/*.json');
Filter and require only .yml
files, with a custom
module.exports = require('export-files')(__dirname, '**/*.json');
Filter and require only .js
files:
module.exports = require('export-files')(__dirname, /\.js$/);
{%= related(['map-files', 'micromatch', 'file-reader']) %}
{%= include("tests") %}
{%= include("contributing") %}
{%= include("author") %}
{%= copyright({start: 2014}) %} {%= license() %}
{%= include("footer") %}
{%= reflinks(['export-files']) %}