Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsyringe

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsyringe - npm Package Compare versions

Comparing version 4.2.0 to 4.3.0

13

dist/cjs/lazy-helpers.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class DelayedConstructor {
constructor(delayedConstructor) {
this.delayedConstructor = delayedConstructor;
constructor(wrap) {
this.wrap = wrap;
this.reflectMethods = [

@@ -25,3 +25,3 @@ "get",

if (!init) {
value = createObject(this.delayedConstructor);
value = createObject(this.wrap());
init = true;

@@ -47,5 +47,8 @@ }

exports.DelayedConstructor = DelayedConstructor;
function delay(delayedConstructor) {
return new DelayedConstructor(delayedConstructor);
function delay(wrappedConstructor) {
if (typeof wrappedConstructor === "undefined") {
throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");
}
return new DelayedConstructor(wrappedConstructor);
}
exports.delay = delay;
export class DelayedConstructor {
constructor(delayedConstructor) {
this.delayedConstructor = delayedConstructor;
constructor(wrap) {
this.wrap = wrap;
this.reflectMethods = [

@@ -23,3 +23,3 @@ "get",

if (!init) {
value = createObject(this.delayedConstructor);
value = createObject(this.wrap());
init = true;

@@ -44,4 +44,7 @@ }

}
export function delay(delayedConstructor) {
return new DelayedConstructor(delayedConstructor);
export function delay(wrappedConstructor) {
if (typeof wrappedConstructor === "undefined") {
throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");
}
return new DelayedConstructor(wrappedConstructor);
}
import { __read, __spread } from "tslib";
var DelayedConstructor = (function () {
function DelayedConstructor(delayedConstructor) {
this.delayedConstructor = delayedConstructor;
function DelayedConstructor(wrap) {
this.wrap = wrap;
this.reflectMethods = [

@@ -25,3 +25,3 @@ "get",

if (!init) {
value = createObject(_this.delayedConstructor);
value = createObject(_this.wrap());
init = true;

@@ -52,4 +52,7 @@ }

export { DelayedConstructor };
export function delay(delayedConstructor) {
return new DelayedConstructor(delayedConstructor);
export function delay(wrappedConstructor) {
if (typeof wrappedConstructor === "undefined") {
throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");
}
return new DelayedConstructor(wrappedConstructor);
}
import constructor from "./types/constructor";
export declare class DelayedConstructor<T> {
private delayedConstructor;
private wrap;
private reflectMethods;
constructor(delayedConstructor: constructor<T>);
constructor(wrap: () => constructor<T>);
createProxy(createObject: (ctor: constructor<T>) => T): T;
private createHandler;
}
export declare function delay<T>(delayedConstructor: constructor<T>): DelayedConstructor<T>;
export declare function delay<T>(wrappedConstructor: () => constructor<T>): DelayedConstructor<T>;
{
"name": "tsyringe",
"version": "4.2.0",
"version": "4.3.0",
"description": "Lightweight dependency injection container for JavaScript/TypeScript",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -484,3 +484,3 @@ [![Travis](https://img.shields.io/travis/Microsoft/tsyringe.svg)](https://travis-ci.org/Microsoft/tsyringe/)

export class Foo {
constructor(@inject(delay(Bar)) public bar: Bar) {}
constructor(@inject(delay(() => Bar)) public bar: Bar) {}
}

@@ -490,3 +490,3 @@

export class Bar {
constructor(@inject(delay(Foo)) public foo: Foo) {}
constructor(@inject(delay(() => Foo)) public foo: Foo) {}
}

@@ -515,3 +515,3 @@

// `DelayedConstructor` of Bar will be the token
useToken: delay(Bar)
useToken: delay(() => Bar)
}

@@ -528,3 +528,3 @@ ])

token: "IFoo",
useToken: delay(Foo)
useToken: delay(() => Foo)
}

@@ -531,0 +531,0 @@ ])

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