UNPKG

arch-unit-ts

Version:
31 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AllowEmptyShould = void 0; const Assert_1 = require("../../error/domain/Assert"); const ArchConfiguration_1 = require("../ArchConfiguration"); const AllowEmptyShouldType_1 = require("./AllowEmptyShouldType"); class AllowEmptyShould { type; constructor(type) { Assert_1.Assert.notNullOrUndefined('type', type); this.type = type; } static fromBoolean(allow) { return new AllowEmptyShould(allow ? AllowEmptyShouldType_1.AllowEmptyShouldType.TRUE : AllowEmptyShouldType_1.AllowEmptyShouldType.FALSE); } static asConfigured() { return new AllowEmptyShould(AllowEmptyShouldType_1.AllowEmptyShouldType.AS_CONFIGURED); } isAllowed() { switch (this.type) { case AllowEmptyShouldType_1.AllowEmptyShouldType.TRUE: return true; case AllowEmptyShouldType_1.AllowEmptyShouldType.FALSE: return false; case AllowEmptyShouldType_1.AllowEmptyShouldType.AS_CONFIGURED: return !ArchConfiguration_1.ArchConfiguration.get().failOnEmptyShould; } } } exports.AllowEmptyShould = AllowEmptyShould; //# sourceMappingURL=AllowEmptyShould.js.map