dependency-injection
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -117,3 +117,3 @@ // Generated by CoffeeScript 1.6.3 | ||
Helpers.autowireArguments = function(method, args, container) { | ||
var dots, factory, parameter, previousDots, result, service, _i, _len, _ref; | ||
var dots, factory, hints, i, originalArgs, parameter, previousDots, result, service, _i, _len, _ref; | ||
if (args == null) { | ||
@@ -127,11 +127,13 @@ args = []; | ||
args = Helpers.clone(args); | ||
if (args.length === 0) { | ||
args = Helpers.getHintArguments(method); | ||
if (args === null) { | ||
args = []; | ||
} | ||
originalArgs = args; | ||
hints = Helpers.getHintArguments(method); | ||
if (hints !== null) { | ||
args = Helpers.clone(hints); | ||
} | ||
_ref = Helpers.getArguments(method); | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
parameter = _ref[_i]; | ||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { | ||
parameter = _ref[i]; | ||
if (args[0] === '...' && hints !== null) { | ||
args[0] = originalArgs[i]; | ||
} | ||
if (typeof args[0] !== 'undefined' && args[0] === '...') { | ||
@@ -138,0 +140,0 @@ dots = true; |
{ | ||
"name": "dependency-injection", | ||
"description": "Dependency injection with configuration and autowire for node js and browser", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "David Kudera", |
@@ -398,2 +398,5 @@ [![NPM version](https://badge.fury.io/js/dependency-injection.png)](http://badge.fury.io/js/dependency-injection) | ||
* 2.0.1 | ||
+ Injecting by arguments and hints was not working | ||
* 2.0.0 | ||
@@ -400,0 +403,0 @@ + Removed autowiring into `inject` methods (BC break!) |
@@ -116,2 +116,12 @@ // Generated by CoffeeScript 1.6.3 | ||
}); | ||
it('should inject services to another service with argument and hint', function() { | ||
var fn; | ||
fn = function(something, sameThing) { | ||
return { | ||
'@di:inject': ['...', '@data'] | ||
}; | ||
}; | ||
di.addService('data', ['one']).setInstantiate(false); | ||
return expect(Helpers.autowireArguments(fn, ['@data'], di)).to.be.eql([['one'], ['one']]); | ||
}); | ||
it('should inject services replaced with dots in the end', function() { | ||
@@ -118,0 +128,0 @@ var fn; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
148376
2564
494