UNPKG

@jems/di

Version:

An implementation of IoC pattern based on dependency injection that allows you to granulate and decouple your libraries or applications. Wrote using SOLID principles and a variety OOP patterns implementations.

25 lines (24 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var servicingError_1 = require("../errors/servicingError"); /** * Represents a servicing strategy that transform and serve dependency metadata references as a constant. */ var ConstantServicingStrategy = /** @class */ (function () { function ConstantServicingStrategy() { } /** * Serve the result of the given reference target transformation. * @param resolutionContext Represents the resolution context of the servicing. * @param dependencyMetadata Represents the dependency metadata to transformed. * @return The transformed reference target. */ ConstantServicingStrategy.prototype.serve = function (resolutionContext, dependencyMetadata) { if (dependencyMetadata.activationReference === undefined || dependencyMetadata.activationReference === null) { throw new servicingError_1.ServicingError('The metadata reference target can not be undefined or null'); } return dependencyMetadata.activationReference; }; return ConstantServicingStrategy; }()); exports.ConstantServicingStrategy = ConstantServicingStrategy;