Comparing version 0.5.1 to 0.5.2
@@ -0,1 +1,2 @@ | ||
import { Token } from "../Token"; | ||
/** | ||
@@ -9,1 +10,5 @@ * Injects a service into a class property or constructor parameter. | ||
export declare function Inject(serviceName?: string): Function; | ||
/** | ||
* Injects a service into a class property or constructor parameter. | ||
*/ | ||
export declare function Inject(token: Token<any>): Function; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Container_1 = require("../Container"); | ||
var Token_1 = require("../Token"); | ||
/** | ||
@@ -15,3 +16,15 @@ * Injects a service into a class property or constructor parameter. | ||
index: index, | ||
value: function () { return Container_1.Container.get(typeof typeOrName === "string" ? typeOrName : typeOrName()); } | ||
value: function () { | ||
var identifier; | ||
if (typeof typeOrName === "string") { | ||
identifier = typeOrName; | ||
} | ||
else if (typeOrName instanceof Token_1.Token) { | ||
identifier = typeOrName; | ||
} | ||
else { | ||
identifier = typeOrName(); | ||
} | ||
return Container_1.Container.get(identifier); | ||
} | ||
}); | ||
@@ -18,0 +31,0 @@ }; |
{ | ||
"name": "typedi", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Dependency injection for TypeScript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57210
584