UNPKG

584 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const decorators_1 = require("./decorators");
4exports.InjectedServiceFactory = (Service) => (sm) => {
5 const service = new Service;
6 const dependencies = decorators_1.getDependencies(service);
7 if (!dependencies) {
8 return service;
9 }
10 return dependencies.reduce((service, { property, dependency, plugin }) => {
11 service[property] = plugin ? plugin(sm, service) : sm.get(dependency);
12 return service;
13 }, service);
14};
15//# sourceMappingURL=InjectedServiceFactory.js.map
\No newline at end of file