1.0.1 • Published 8 years ago

hypodi v1.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

HypoDI is a di container for node.

Features

  • Singleton services
  • Factories (providers)
  • Interfaces (api will change)
  • Self register (experimental)
  • Hot-reload (experimental)

Install

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

Service

hypodi.service('beer', ['water', 'malt'], beerFactory);
hypodi.get('beer')

Factory

hypodi.factory('bottle', bottleFactory);
const bottle1 = hypodi.get('bottle');
const bottle2 = hypodi.get('bottle');

Interfaces

hypodi.factory('greenBottle', greenBottleFactory);
hypodi.factory('blueBottle', blueBottleFactory);
hypodi.iface('bottle', 'greenBottle')
hypodi.iface('bottle', 'blueBottle')
const aGreenBottle = hypodi.get('bottle')('greenBottle');