@lillallol/dic
Version:
My own dependency injection container.
14 lines (13 loc) • 554 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwIfAlreadyRegistered = void 0;
const errorMessages_1 = require("../errorMessages");
/**
* @description
* Throws error if the provided abstraction is already registered in the provided registry.
*/
function throwIfAlreadyRegistered(abstraction, registry) {
if (registry.get(abstraction) !== undefined)
throw Error(errorMessages_1.errorMessages.abstractionAlreadyRegistered(abstraction));
}
exports.throwIfAlreadyRegistered = throwIfAlreadyRegistered;