Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit ac06724

Browse files
committed
Refactoring for better reading and understanding of instantiate function
1 parent 570463a commit ac06724

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/auto/injector.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,11 +582,15 @@ function createInjector(modulesToLoad) {
582582
}
583583
}
584584

585+
function isInlineAnnotated(fn){
586+
return isArray(fn);
587+
}
588+
585589
function instantiate(Type, locals) {
586590
var Constructor = function() {},
587591
instance, returnedValue;
588592

589-
Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
593+
Constructor.prototype = (isInlineAnnotated(Type) ? Type[Type.length - 1] : Type).prototype;
590594
instance = new Constructor();
591595
returnedValue = invoke(Type, instance, locals);
592596

0 commit comments

Comments
 (0)