Injecorator
A simple decorater based dependecy injection framework for nodejs es6 projects
Installation
$ npm install injecorator --save
Usage
usage requiring babel-plugin-transform-decorators-legacy with babel 6
; const staticObject = staticdep: true ; @ { thisstatic = staticOb; thisisReallyOne = true; } @ { thisstatic = staticOb; thisone = oneCls; thisisReallyTwo = true; } const ioc = ;ioc;const two = ioc;console;
Without using javascript decorators set a static property $inject on the object that contains an array of dependencies
{ thistwo = two; thisisReallyThree = true; } Three$inject = Two;
Registering an extension or replacement depency
const ioc = ;ioc;ioc;const two = ioc;tobe;
Registering a factory method as a value provider. The argument passed to this method is an instance of the ioc container
{ superstaticOb; thisisDerivedOne = true; } const ioc = ;ioc;ioc; const one = ioc;tobe;