Comparing version 1.2.1 to 1.3.0
@@ -17,2 +17,3 @@ import { Scope } from './scope'; | ||
resolve<T>(key: ServiceKey<T>): T; | ||
tryResolve<T>(key: ServiceKey<T>): T | undefined; | ||
connect<T>(value: T): T; | ||
@@ -19,0 +20,0 @@ use(fn: Middleware): this; |
@@ -31,2 +31,10 @@ "use strict"; | ||
resolve(key) { | ||
const instance = this.tryResolve(key); | ||
if (instance === undefined) { | ||
const k = util_1.keyToString(key); | ||
throw new errors_1.MeshBindingNotFound(this.name, k); | ||
} | ||
return instance; | ||
} | ||
tryResolve(key) { | ||
const k = util_1.keyToString(key); | ||
@@ -45,5 +53,5 @@ let instance = this.instances.get(k); | ||
if (this.parent) { | ||
return this.parent.resolve(key); | ||
return this.parent.tryResolve(key); | ||
} | ||
throw new errors_1.MeshBindingNotFound(this.name, k); | ||
return undefined; | ||
} | ||
@@ -50,0 +58,0 @@ connect(value) { |
{ | ||
"name": "mesh-ioc", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Mesh: Powerful and Lightweight IoC Library", | ||
@@ -18,3 +18,3 @@ "main": "out/main/index.js", | ||
"version": "npm run compile", | ||
"postversion": "npm publish --access=public" | ||
"postversion": "npm publish --access=public && git push origin main --tags" | ||
}, | ||
@@ -21,0 +21,0 @@ "pre-commit": [ |
27860
385