index.js
function toExports(dir, patterns, recurse, options, fn) {
  if (arguments.length === 1 && !isGlob(dir)) {

    var key = 'toExports:' + dir;
    if (cache.hasOwnProperty(key)) {
      return cache[key];
    }

    var result = lookup(dir, false, {}).reduce(function (res, fp) {
      if (filter(fp, fn)) {
        res[basename(fp)] = read(fp, fn);
      }
      return res;
    }, {});
    return (cache[key] = result);
  }
  return explode.apply(explode, arguments);
}
function toExports(dir, patterns, recurse, options, fn) {
  if (arguments.length === 1 && !isGlob(dir)) {

    var key = 'toExports:' + dir;
    if (cache.hasOwnProperty(key)) {
      return cache[key];
    }

    var result = lookup(dir, false, {}).reduce(function (res, fp) {
      if (filter(fp, fn)) {
        res[basename(fp)] = read(fp, fn);
      }
      return res;
    }, {});
    return (cache[key] = result);
  }
  return explode.apply(explode, arguments);
}
function toExports ( dir , patterns , recurse , options , fn ) { if ( arguments . length === 1 && ! isGlob ( dir ) ) { var key = 'toExports:' + dir ; if ( cache . hasOwnProperty ( key ) ) { return cache [ key ] ; } var result = lookup ( dir , false , { } ) . reduce ( function ( res , fp ) { if ( filter ( fp , fn ) ) { res [ basename ( fp ) ] = read ( fp , fn ) ; } return res ; } , { } ) ; return ( cache [ key ] = result ) ; } return explode . apply ( explode , arguments ) ; }
Export files from the give `directory` filtering the
results with

@param  {String} `directory` Use `__dirname` for the immediate directory.
@param  {String|Array} `patterns` Glob patterns to use for matching.
@param  {Boolean} `recurse` Pass `true` to recurse deeper than the current directory.
@param  {String} `options`
@param  {Function} `fn` Callback for filtering.
@return {String}
Export files from the give directory filtering the results with