Dependency injection for node.js
JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src
tests
.gitignore
.npmignore
Gruntfile.js
README.md
package.json

README.md

Depend

Depend is a dependency injection system.

Installation

npm install depend

Usage

depend = require('depend');

depend.add('service1', function () {
    return /* the service */;
});

depend.add('service2', function (service1) {
    /* depends on service1 */
    return /* the service */;
});

var service2 = depend.get('service2');

Testing

depend.inject('service1', function () {
    return /* mock service */
})

var service2 = depend.get('service2');