@lillallol/dic
Version:
My own dependency injection container.
20 lines (19 loc) • 807 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwIfExtraAbstractionsFromTypes = void 0;
const errorMessages_1 = require("../errorMessages");
function throwIfExtraAbstractionsFromTypes(_) {
const { TYPES, dic, entryPointAbstractions } = _;
const extraAbstractionsFromTypes = [];
Object.values(TYPES).forEach((abstraction) => {
if (dic.registry.get(abstraction) === undefined)
extraAbstractionsFromTypes.push(abstraction);
});
if (extraAbstractionsFromTypes.length !== 0) {
throw Error(errorMessages_1.errorMessages.typesHasExtraAbstractions({
entryPointAbstractions,
extraAbstractionsFromTypes,
}));
}
}
exports.throwIfExtraAbstractionsFromTypes = throwIfExtraAbstractionsFromTypes;