metis-desk/packages/rdx-ddd/src/value-objects/name.ts
David e3f92fa534 feat: initialize pnpm workspace and add configuration files
- Added pnpm-workspace.yaml to define package structure.
- Created prepare-local-env.py script for local environment setup.
- Introduced tsconfig.json for TypeScript configuration.
- Added turbo.json for task management with Turbo.
2026-10-03 12:36:03 +02:00

14 lines
416 B
TypeScript

import { Result } from "@repo/rdx-utils";
import { ValueObject } from "./value-object";
export class Name extends ValueObject<string> {
static create(value: string, maxLength = 255): Result<Name, Error> {
const normalized = value.trim();
if (!normalized || normalized.length > maxLength) {
return Result.fail(new Error("Nombre inválido."));
}
return Result.ok(new Name(normalized));
}
}