Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

b-ioc-js

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

b-ioc-js

A magic free, dirt simple IoC container for Javascript.

latest
Source
npmnpm
Version
2.2.8
Version published
Maintainers
1
Created
Source

b-ioc

b-ioc is a tiny and magic free IoC container for Node. It helps you manage dependencies and facilitates an easy testing environment for your modules.

Installation

npm install b-ioc --save

Small Introduction

var Ioc = require('b-ioc');

var ClassA = require('class-a');
var ClassB = require('class-b');

// binding the classes
Ioc.bind('classA', function() {
  return new ClassA();
});

Ioc.bind('classB', function() {
  // classB needs classA as a dependency
  var classA = Ioc.use('classA');
  return new ClassB(classA);
});

// using the bindings
var classB = Ioc.use('classB');

Be sure to consult the documentation for more examples and an in depth look at the API.

Documentation

Keywords

require

FAQs

Package last updated on 12 Dec 2025

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