Skip to content

Commit dc756f4

Browse files
committed
fix(dependency-injection): adjust based on review
Fixes #171
1 parent ac4e6f9 commit dc756f4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/injection.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ export function autoinject(potentialTarget?: any): any {
88
let deco = function(target) {
99
if (!target.hasOwnProperty('inject')) {
1010
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice();
11-
if (target.inject &&
12-
target.inject.length > 0) {
13-
// TypeScript 3.0 metadata for "...rest" gives type "Object"
14-
// if last parameter is "Object", assume it's a ...rest and remove that metadata.
15-
if (target.inject[target.inject.length - 1] === Object) {
16-
target.inject.splice(-1,1);
17-
}
11+
// TypeScript 3.0 metadata for "...rest" gives type "Object"
12+
// if last parameter is "Object", assume it's a ...rest and remove that metadata.
13+
if (target.inject.length > 0 &&
14+
target.inject[target.inject.length - 1] === Object) {
15+
target.inject.pop();
1816
}
1917
}
2018
};

0 commit comments

Comments
 (0)