Permalink
Browse files

perf(container): improve dynamic construction of static depencies

  • Loading branch information...
EisenbergEffect committed Jul 29, 2017
1 parent f83d33c commit 01b2988aeece6b2a248e051bbf05a52752cf64d0
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/container.js
View
@@ -74,12 +74,16 @@ export interface ContainerConfiguration {
function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) {
let i = staticDependencies.length;
let args = new Array(i);
let lookup;
while (i--) {
if (staticDependencies[i] === null || staticDependencies[i] === undefined) {
lookup = staticDependencies[i];
if (lookup === null || lookup === undefined) {
throw new Error('Constructor Parameter with index ' + i + ' cannot be null or undefined. Are you trying to inject/register something that doesn\'t exist with DI?');
} else
args[i] = container.get(staticDependencies[i]);
} else {
args[i] = container.get(lookup);
}
}
if (dynamicDependencies !== undefined) {

0 comments on commit 01b2988

Please sign in to comment.