require node scripts recursive.
CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
src
tests
.gitignore
.npmignore
.travis.yml
Makefile
README.md
package.json

README.md

direquire

require node scripts recursive.

Usage

Start coding:

$ npm i direquire

Include in your project:

direquire = require('direquire');

Use:

var module = direquire('./modules');

How to use

module named by object name e.g. exports.moduleName.

nested module named by directory name.

Example:

modules/
├── module1
│   ├── module11.coffee (exports.Module11 = ->)
│   └── module12.coffee (exports.Module12 = ->)
├── module1.coffee      (exports.Module1 = ->)
├── module2
│   ├── module21.coffee (exports.module21 = ->)
│   └── module22.coffee (exports.module22 = ->)
└── module2.coffee      (exports.module2 = ->)

Execute:

var modules = direquire('./modules');
console.log(modules);

Returns:

{
  module1: {
    Module11: [Function],
    Module12: [Function]
  },
  Module1: [Function],
  module2: {
    [Function]
    module21: [Function],
    module22: [Function]
  }
}