A small dependency injection framework for node.js.
- Register modules with dependencies.
- Register literals without dependencies.
- Dependency injection framework is immutable.
- 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.
npm install deinconstdein=require('dein');dein.registerLiteral('someString','Hello World').register('someModule',someString=>`${someString}!!!`).resolve('someModule').then((result)=>{console.log('Result: '+result);// Expected: `Result: Hello World!!!});npm test