ioc-service-container
Advanced tools
Comparing version
@@ -8,2 +8,8 @@ # Changelog | ||
## [1.1.0] - 2020-02-16 | ||
### Changed | ||
* renamed `@injectViaId` to `@inject` so `@inject` can be used with an optional serviceId parameter | ||
## [1.0.0] - 2020-02-15 | ||
@@ -10,0 +16,0 @@ |
@@ -1,2 +0,1 @@ | ||
export declare function inject(target: Object, propertyKey: string): void; | ||
export declare function injectViaId(serviceId: string): (target: Object, propertyKey: string) => void; | ||
export declare function inject(serviceIdOrTarget: Object | string, propertyKey?: string): any; |
import ServiceContainer from './ServiceContainer'; | ||
export function inject(target, propertyKey) { | ||
redefineObject(target, propertyKey); | ||
export function inject(serviceIdOrTarget, propertyKey) { | ||
if (typeof serviceIdOrTarget === 'string') { | ||
return function (target, propertyKey) { | ||
redefineObject(target, propertyKey, serviceIdOrTarget); | ||
}; | ||
} | ||
redefineObject(serviceIdOrTarget, propertyKey); | ||
} | ||
export function injectViaId(serviceId) { | ||
return function (target, propertyKey) { | ||
redefineObject(target, propertyKey, serviceId); | ||
}; | ||
} | ||
function redefineObject(target, propertyKey, serviceId) { | ||
@@ -11,0 +11,0 @@ const getter = () => { |
{ | ||
"name": "ioc-service-container", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Lightweight ioc service container", | ||
@@ -10,3 +10,4 @@ "main": "dist/index.js", | ||
"example": "ts-node example/example.ts", | ||
"test": "jest" | ||
"test": "jest", | ||
"sonar": "sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mrcwbr -Dsonar.projectKey=ioc-service-container -Dsonar.sources=src -Dsonar.tests=tests" | ||
}, | ||
@@ -18,5 +19,6 @@ "author": "mrcwbr", | ||
"jest": "^26.6.3", | ||
"ts-jest": "^26.4.4", | ||
"ts-jest": "^26.5.1", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.3" | ||
"typescript": "^4.1.5", | ||
"sonarqube-scanner": "^2.8.0" | ||
}, | ||
@@ -23,0 +25,0 @@ "files": [ |
# ioc-service-container | ||
[](https://sonarcloud.io/dashboard?id=mrcwbr_ioc-service-container) | ||
[](https://sonarcloud.io/dashboard?id=mrcwbr_ioc-service-container) | ||
[](https://sonarcloud.io/dashboard?id=ioc-service-container) | ||
[](https://sonarcloud.io/dashboard?id=ioc-service-container) | ||
[](https://sonarcloud.io/dashboard?id=ioc-service-container) | ||
[](https://sonarcloud.io/dashboard?id=ioc-service-container) | ||
[](https://sonarcloud.io/dashboard?id=ioc-service-container) | ||
 | ||
 | ||
 | ||
 | ||
 | ||
@@ -9,3 +17,5 @@ This is a lightweight library for a service container written in TypeScript. | ||
<a href="https://www.buymeacoffee.com/Mrcwbr" target="_blank"> | ||
<img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > | ||
<img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" | ||
alt="Buy Me A Coffee" | ||
style="height: 41px !important;width: 174px !important;box-shadow: 0 3px 2px 0 rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0 3px 2px 0 rgba(190, 190, 190, 0.5) !important;" > | ||
</a> | ||
@@ -59,3 +69,3 @@ | ||
@injectViaId(ServiceId.FooApi) | ||
@inject(ServiceId.FooApi) | ||
private readonly nameThisHowYouWant!: FooApi // If you don't want to name your property like the service id, use this decorator | ||
@@ -62,0 +72,0 @@ } |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
8796
15.78%122
8.93%6
20%66
-1.49%1
Infinity%