UNPKG

@hexadrop/value-object

Version:

Hexagonal architecture utils library

2 lines 686 B
import l from"@hexadrop/error/invalid-argument";var e=class extends l{constructor(t){super(`${t??"BooleanValueObject"} can not be null or empty`,"EmptyBooleanValueError","HEX(400)")}},r=class extends l{constructor(t){super(`${t??"BooleanValueObject"} must only contains boolean values`,"InvalidBooleanValueTypeError","HEX(400)")}};var a=class n{value;constructor(t,o){n.notEmpty(t,o),n.allowedValue(t,o),this.value=t}static allowedValue(t,o){if(typeof t!="boolean")throw new r(o)}static notEmpty(t,o){if(t==null)throw new e(o)}isEqualsTo(t){return this.value===t.value}toString(){return JSON.stringify(this.value)}};export{a as default}; //# sourceMappingURL=boolean.value-object.js.map