new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Zod · all subjects

methods

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Wrapper methods for schema modification

Schema wrappers include: optional() and nonoptional() for optionality, nullable() and nullish() for null handling, default() to set default values, array() to wrap in an array schema, or() to create union types, transform() to transform parsed values, catch() to provide fallback values, pipe() to chain schemas, and readonly() to mark as read-only.

Metadata and registry methods

Schemas support register() to register with a registry, describe() to add descriptions, and meta() to attach metadata.

Utility methods on ZodType

Utility methods include check() for validation checks, clone() to create a copy of the schema with optional definition updates, brand() for type branding, isOptional() to check if schema is optional (returns boolean), and isNullable() to check if schema is nullable (returns boolean).

apply() incorporates external functions into method chain

Use .apply() to incorporate external functions into Zod's method chain. Example: z.number().apply(setCommonNumberChecks).nullable() where setCommonNumberChecks is a function that receives and returns the schema with modifications applied.

Give your agent this brain