1 |
|
2 | var annotateContainer;
|
3 |
|
4 | annotateContainer = function(container) {
|
5 | var modules, noValues;
|
6 | modules = container._registrations;
|
7 | noValues = function(i) {
|
8 | return modules[i].type !== 'value';
|
9 | };
|
10 | return Object.keys(modules).filter(noValues).reduce(function(sum, name) {
|
11 | sum[name] = container.getArguments(name);
|
12 | return sum;
|
13 | }, {});
|
14 | };
|
15 |
|
16 | module.exports = function(container) {
|
17 | var annotations;
|
18 | if (container == null) {
|
19 | return {};
|
20 | }
|
21 | annotations = container._parents.map(annotateContainer);
|
22 | annotations.push(annotateContainer(container));
|
23 | return annotations.reduce(function(acc, item) {
|
24 | Object.keys(item).forEach(function(key) {
|
25 | return acc[key] = item[key];
|
26 | });
|
27 | return acc;
|
28 | }, {});
|
29 | };
|