8000 GitHub - ecowden/require-path: Recursively `require(...)` files from a directory tree in Node.js
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ecowden/require-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

require-path

Recursively require(...) files from a directory tree in Node.js

Works with Node.js v4.0.0 and above.

Branch Status
Master Build Status
All Build Status

Usage

var path = require('path');

requirePath({
    path: path.join(__dirname, 'my-directory'),
    include: ['**/*.js', '**/*.json'],
    exclude: ['**/*Spec.js']
  })
  // returns a standard promise
  .then(function (modules) {
    // `modules` is a map of filenames to require()'d components from those files
  })
  // don't forget to handle errors!
  .catch(handleError);

Options

Property Description
path string or array of absolute paths to search for files. Default: ..
include string or array of minimatch patterns. A file in the path(s) that match at least one pattern will be require(...)'d unless the file also matches an exclusion pattern. Default: ['**/*.js', '**/*.json'].
exclude string or array of minimatch patterns. Files in the path(s) that match at least one pattern will be excluded. Default: ['**/*Spec.js'].

About

Recursively `require(...)` files from a directory tree in Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0