UNPKG

975 BJavaScriptView Raw
1"use strict";
2const DI = require('./di');
3const exports_1 = require('../core/exports');
4let repoSource = function (target) {
5 let repo;
6 if (!target) {
7 return null;
8 }
9 Object.keys(exports_1.repositoryMap())
10 .forEach(x => {
11 //// TODO: Decide repository map will hold the prototype or the function
12 var path;
13 if (target.prototype) {
14 path = target.prototype.path;
15 }
16 else if (target['default']) {
17 path = target['default'].prototype.path;
18 }
19 if (path === x) {
20 repo = exports_1.repositoryMap()[x].repo;
21 }
22 //if (repositoryMap()[x].fn === target || <Function>repositoryMap()[x].fn === target.prototype|| (target.prototype && x === target.prototype.path)) {
23 // repo = repositoryMap()[x].repo;
24 //}
25 });
26 return repo;
27};
28DI.Container.addSource(repoSource);
29exports.Container = DI.Container;
30
31//# sourceMappingURL=index.js.map