New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

inject-decorators

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inject-decorators

simple dependency injector

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

inject-decorators

Simple dependency injector.

Get started

npm install --save-dev inject-decorators

Usage

let num = 1;
let str = "abc";
let bool = true;
let symbol = Symbol();

@Inject(num, str, bool, symbol)
class Foo {
  constructor(num, str, bool, symbol) {
    this.num = num;
    this.str = str;
    this.bool = bool;
    this.symbol = symbol;
  }
};

let foo = new Foo();

assert(foo.num === num);
assert(foo.str === str);
assert(foo.bool === bool);
assert(foo.symbol === symbol);
class Foo {};

@Inject(Foo)
class Bar {
  constructor(foo) {
    this.foo = foo;
  }
};

@Inject(Bar)
class Baz {
  constructor(bar) {
    this.bar = bar;
  }
}

let baz = new Baz();

assert(baz instanceof Baz);
assert(baz.bar instanceof Bar);
assert(baz.bar.foo instanceof Foo);

Keywords

dependency

FAQs

Package last updated on 25 Oct 2015

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