Codemod verified
Regularly tested and maintained by our engineers and codemod expert community.
byCodemod
Add Zod Validation
Last update
Jul 24, 2024
This codemod adds zod validation to query parsing.
Example
Before
const query = buildQuery(props.location?.search ?? '');const someParam = query?.['some-param'] === 'true';
After
import { z } from 'zod';const querySchema = z.object({'some-param': z.string(),});const query = buildQuery(props.location?.search ?? '');const parsedQuery = querySchema.parse(query);const someParam = parsedQuery['some-param'] === 'true';
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community