Socket
Book a DemoInstallSign in
Socket

teys-injector

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teys-injector

very simple injector for Typescript code to simplify and speed up code production

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

teys-injector

Simple injector syntax for Typescript code. It allows you to set dependency

import { Injectable, Inject } from "teys-injector";

@Injectable()
class Service {
    
    method1(): boolean {
        return false;
    }
}
import { Inject } from "teys-injector";

class OtherClass {
    
    @Inject()
    svc: Service;
    
    method2() {
        return this.svc.method1();
    }
}

You can also register manually values and resolve them

import { Injector } from "teys-injector";

Injector.Register("user", { username: 'default' });
import { Injector } from "teys-injector";

const defaultUser = Injector.Resolve<User>("user");

Not supported yet

  • Injectable constructor parameters

Keywords

typescript

FAQs

Package last updated on 24 Oct 2022

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