13 lines
404 B
TypeScript
13 lines
404 B
TypeScript
import { ValueObject } from "@repo/rdx-ddd";
|
|
import { Result } from "@repo/rdx-utils";
|
|
|
|
export class SiteAddress extends ValueObject<string> {
|
|
static create(value: string): Result<SiteAddress, Error> {
|
|
const normalized = value.trim();
|
|
|
|
return normalized && normalized.length <= 10000
|
|
? Result.ok(new SiteAddress(normalized))
|
|
: Result.fail(new Error("Dirección inválida."));
|
|
}
|
|
}
|