Skip to content
/ dein Public

dependency injection framework for node.js.

Notifications You must be signed in to change notification settings

mren/dein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dein - dependency injection framework

A small dependency injection framework for node.js.

  • Register modules with dependencies.
  • Register literals without dependencies.
  • Dependency injection framework is immutable.

Features

  • dein is lazy. Only dependencies which are used are resolved
  • dein allows async dependency resolution by using promises. You can mix synchronous factory methods with asynchronous ones.
  • dein will automatically find the required dependency. No need to define the order of dependencies.

Quick Start

npm install dein
const dein = require('dein');

Examples

dein
  .registerLiteral('someString', 'Hello World')
  .register('someModule', someString => `${someString}!!!`)
  .resolve('someModule')
  .then((result) => {
    console.log('Result: ' + result);
    // Expected: `Result: Hello World!!!
  });

Tests

npm test

About

dependency injection framework for node.js.

Resources

Stars

Watchers

Forks

Packages

No packages published