drop dead simple module definition library


Drop dead simple module definition library.

Modulus simplifies your module definitions by autowiring module function parameters based on the paramater name. e.g. having a parameter called moduleA in your module function will result in modulus finding moduleA and passing it to your module function.

You can play with the specs by going here and selecting Project -> Fork.

View the test results here

##Defining Modules To define a module, simply create a named function:

//defining a module is as simple as creating a function. 
function moduleA(){
    return {
        prop1: 123
//simply by referencing moduleA, you will get its return value passed in as the parameter value. 
function moduleB(moduleA){
    return {
        prop1: moduleA.prop1 + 1

##Start Processing

Each module can have metadata to control behavior of modulus. By specifying autoInit = true, modulus knows to run the function once it's dependencies have been located.

//configure the module to execute without being required by another module first. 
moduleB.module = {
    autoInit: true
//start processing 
modulus.require(function (moduleB){
    console.log(moduleB.prop1); //prints 124