New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iniettore

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iniettore

A light and simple IoC container

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-81.63%
Maintainers
1
Weekly downloads
 
Created
Source

Iniettore Iniettore

Build Status GitHub version NPM dependencies Coverage Status

TODO

  • Dispose sub dependencies
  • Child context support
  • Bind container itself
  • Handle errors in case constructors, providers or dispose fails
    • keep original errors trackable
  • Make possible to pass extra params
  • Complete debug logs
  • Handle errors in case of wrong api calls Impossible to call methods in wrong order with new APIs.
  • Make dispose method name configurable
  • Improve fluid API
    • remove done call
    • add experimental contribution phase into a revealing construction pattern
    • refactor APIs to be more explicit
  • test case when singletons do NOT implement a dispose method (see test coverage)
  • cleanup
    • remove memoize if not used
    • remove merge if not used

DEFER

  • Detect invalid singleton destroy calls. Too complex for a minor benefit.

WONT DO IT

  • Consider derring the release in case the object will be required in the short term - complicated and no real benefits - the container consumer should do that before calling release

Features

Specify ECMA Script 5 required features or polyfills

  • Object.create
  • Function.prototype.bind

Quick start

Installation

node.js:

npm install iniettore --save

Usage

import iniettore from 'iniettore'
import { VALUE, SINGLETON, CONSTRUCTOR } from 'iniettore/lib/options'

class UltimateQuestion {
	constructor(answer) {
		console.log(answer)
	}
}

var container = iniettore.create(function (context) {
	context
		.map('answer')
		.to(42)
		.as(VALUE)

		.map('question')
		.to(UltimateQuestion)
		.as(SINGLETON, CONSTRUCTOR)
		.injecting('answer')
})

var question = container.get('question') // 42

console.log(question instanceof UltimateQuestion) // true

Advanced usage

Value objects and instances

Functions

Providers

Constructor

Child context

Blueprint

Transient dependencies

Notes on singletons

Notes on lifecycle

Instances dispose

Context dispose

Throubleshooting

Keywords

FAQs

Package last updated on 27 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc