import { UndefinedOr } from "../../../../utilities"; import { IValueObjectOptions, ValueObject } from "./ValueObject"; export interface IStringValueObjectOptions extends IValueObjectOptions {} export class StringValueObject extends ValueObject> { public isEmpty = (): boolean => { return this.toString().length === 0; }; public toString = (): string => { return this.props ? String(this.props) : ""; }; public toPrimitive(): string { return this.toString(); } get value(): UndefinedOr { return !this.isEmpty() ? this.props : undefined; } }