> Very simple IoC container for NodeJS
npm install @secjs/ioc> Very simple IoC container for NodeJS


The intention behind this repository is to always maintain a viable and simple IoC to use in any type of NodeJS applications, with or without Frameworks

``bash`
npm install @secjs/ioc
> Container can register dependencies for you, every container.get will create a new instance for UserService.
`js
import { Container } from '@SecJS/IoC'
import { UserService } from 'app/Services/UserService'
const container = new Container()
container.set(UserService)
const userService = container.get
console.log(userService.findAll())
`
> Container can register singleton dependencies, when singleton container.get will return the same UserService instance all time.
`js
import { Container } from '@SecJS/IoC'
import { UserService } from 'app/Services/UserService'
const container = new Container()
container.singleton(UserService, 'props', 'to', 'UserService Constructor here')
const userService = container.get
console.log(userService.findAll())
`
> Singleton can register static objects and arrays too, but for arrays and objects the name is required:
`js
container.singleton([], 'myArray')
container.singleton({}, 'myObject')
console.log(container.get('myArray')) // []
console.log(container.get('myObject')) // {}
``
---
Made with 🖤 by jlenon7 :wave: