Comparing version 0.0.17 to 0.0.18
@@ -27,3 +27,2 @@ import { InjectFlags, Injector } from './injector'; | ||
} | ||
let reflectiveValue = notFoundValue; | ||
for (let i = 0; i < this.normalizedProviders.length; i++) { | ||
@@ -36,20 +35,14 @@ const { provide, deps, factory } = this.normalizedProviders[i]; | ||
const params = this.resolveDeps(deps || [], notFoundValue); | ||
reflectiveValue = ff(...params); | ||
let reflectiveValue = ff(...params); | ||
this.reflectiveValues.set(token, reflectiveValue); | ||
break; | ||
return reflectiveValue; | ||
} | ||
} | ||
if (reflectiveValue === notFoundValue) { | ||
if (flags === InjectFlags.Self && reflectiveValue === THROW_IF_NOT_FOUND) { | ||
throw reflectiveInjectorErrorFn(token); | ||
} | ||
if (this.parentInjector) { | ||
return this.parentInjector.get(token, notFoundValue, flags); | ||
} | ||
if (flags === InjectFlags.Self && notFoundValue === THROW_IF_NOT_FOUND) { | ||
throw reflectiveInjectorErrorFn(token); | ||
} | ||
if (reflectiveValue === null || typeof reflectiveValue === 'undefined') { | ||
throw reflectiveInjectorErrorFn(token); | ||
if (this.parentInjector) { | ||
return this.parentInjector.get(token, notFoundValue, flags === InjectFlags.Optional ? InjectFlags.Optional : InjectFlags.Default); | ||
} | ||
return reflectiveValue; | ||
throw reflectiveInjectorErrorFn(token); | ||
} | ||
@@ -56,0 +49,0 @@ resolveDeps(deps, notFoundValue) { |
{ | ||
"name": "@tanbo/di", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "A dependency injection Library", | ||
@@ -5,0 +5,0 @@ "main": "./bundles/public-api.js", |
21352
601