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

schema definitions/stringbool

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

String validation methods in Zod

z.string() supports the following validation methods: .max(n), .min(n), .length(n), .nonempty() (alias for .min(1)), .regex(pattern), .startsWith(string), .endsWith(string), .includes(string), .uppercase(), .lowercase(). In Zod Mini, these use .check() with named functions like z.maxLength(), z.minLength(), z.length(), z.regex(), z.startsWith(), z.endsWith(), z.includes(), z.uppercase(), z.lowercase().

String transform methods in Zod

z.string() supports the following transform methods: .trim() to trim whitespace, .toLowerCase() to convert to lowercase, .toUpperCase() to convert to uppercase, .normalize() to normalize unicode characters. In Zod Mini these use .check() with z.trim(), z.toLowerCase(), z.toUpperCase(), z.normalize().

Boolean validation

z.boolean() validates boolean values. z.boolean().parse(true) returns true, z.boolean().parse(false) returns false.

Date validation

z.date() validates Date instances. Use z.date().min(date) to set minimum date and z.date().max(date) to set maximum date. Customize error messages with z.date({ error: issue => string }). In Zod Mini, constraints use .check() with z.minimum() and z.maximum().

z.stringbool() for parsing boolish strings

Introduced in zod@4.0. z.stringbool() parses string 'boolish' values to plain boolean. Default truthy values: ['true', '1', 'yes', 'on', 'y', 'enabled']. Default falsy values: ['false', '0', 'no', 'off', 'n', 'disabled']. Case-insensitive by default; make case-sensitive with z.stringbool({ case: 'sensitive' }). Customize truthy/falsy values: z.stringbool({ truthy: [...], falsy: [...] }).

z.json() validates JSON-encodable values

z.json() validates any JSON-encodable value. It returns a union schema of: string, number, boolean, null, array(jsonSchema), and record(string, jsonSchema) - a recursive definition supporting nested structures.

z.stringbool() for environment-style boolean coercion

z.stringbool() parses strings to booleans with environment-style logic. Truthy values: 'true', '1', 'yes', 'on', 'y', 'enabled'. Falsy values: 'false', '0', 'no', 'off', 'n', 'disabled'. Any other value throws a ZodError.

z.stringbool() custom truthy and falsy values

Customize z.stringbool() behavior with options: z.stringbool({ truthy: ['yes', 'true'], falsy: ['no', 'false'] })

Give your agent this brain