@samuray/di
v0.0.8
Published
DI container
Downloads
9
Readme
DI
DI container.
Example
const di = require('@samuray/di');
di.register('port', 3000);
di.factory('server', require('./server'), ['port']);
const server = di.get('server');
server.start();
DI.register(name:str, definition:any, [dependences:array[str]])
Add record (singleton) to catalog.
DI.factory(name:str, definition:function, [dependences:array[str]])
Add factory to catalog.
DI.get(name:str) -> Any
Get instance of class or record (singleton) from catalog.