0.1.0 • Published 2 years ago

@xprofiler/injection v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

injection

codecov Node.js CI License

An IoC implemention for xprofiler.

Usage

Decorator

import { Injectable, Inject } from "@xprofiler/injection";
import { Config } from "./config";

@Injectable()
export class Foo {
  @Inject()
  private config: Config;

  getKmsConfig(@Inject('KMS_KEY') key: string) {
    return this.config[key];
  }
}

Container

import { Container } from "@xprofiler/injection";
import { Foo, Bar } from "./items";

const container = new Container();

container.set(Foo);
container.set(Bar);

const foo = container.get(Foo);
const bar = container.get(Bar);
0.1.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago