recursive-loader

0.0.2 • Public • Published

Recursive Loader Build Status

Load modules recursive and save them in an object.

Getting Started

Install the module with: npm install recursive-loader

var loader = require('recursive-loader'),
    modules = loader.load('./my-modules');
 
modules.myFunction();
// OR
modules.world.hello();

Documentation

Configuration

priority

  • Type: String,
  • Default: directory

Specifies the priority you want to use. For example, file.

formatFilename

  • Type: Function,
  • Default: Return camlized filename

formatDirname

  • Type: Function,
  • Default: Return camlized dirname

Usage examples

Use file as priority for loading modules.

var loader = require('recursive-loader');
 
loader.priority = 'file';
 
// load and use modules

Use custom formatter for file or dirname.

var loader = require('recursive-loader');
 
loader.formatFilename = function(filename) {
    
    return filename.replace('-', '').toUpperCase();
};
 
loader.formatDirname = function(dirname) {
    
    return dirname.replace('-', '').toLowerCase();
};
 
// load and use modules

License

Copyright (c) 2014 Florian Goße. Licensed under the MIT license.

/recursive-loader/

    Package Sidebar

    Install

    npm i recursive-loader

    Weekly Downloads

    4

    Version

    0.0.2

    License

    none

    Last publish

    Collaborators

    • floriangosse