Create a new value object builder.
Value objects are schema-backed primitives for domain concepts such as email addresses or money values. Beignet does not add a runtime brand; the schema output controls the runtime value.
const Email = defineValueObject("Email") .schema(z.string().email()) .build();type Email = typeof Email.Type;const email = await Email.create("test@example.com"); // OKconst isValid = await Email.isValid("test@example.com"); // true Copy
const Email = defineValueObject("Email") .schema(z.string().email()) .build();type Email = typeof Email.Type;const email = await Email.create("test@example.com"); // OKconst isValid = await Email.isValid("test@example.com"); // true
Create a new value object builder.
Value objects are schema-backed primitives for domain concepts such as email addresses or money values. Beignet does not add a runtime brand; the schema output controls the runtime value.