Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@anmiles/zod-tools

anmiles173MIT1.0.2TypeScript support: included

Collection of utility functions for zod library

zod, schema, validation

readme

@anmiles/zod-tools

Collection of utility functions for zod library


Installation

npm install @anmiles/zod-tools

Usage

import { validate } from '@anmiles/zod-tools';

const customSchema = z.object({
    prop: z.object({
        num: z.number(),
        str: z.string(),
    }),
});

const correctJSON = JSON.parse('{"prop":{"num":5,"str":"value"}}');

const obj = validate(correctJSON, customSchema);
// ^? const obj: { prop: { num: string, str: string } } = { prop: { num: 5, str: 'value' }}

const incorrectJSON = JSON.parse('{"prop":{"num":"wrong"}}');

/*
Validation failed:
    prop.num (Invalid input: expected number, received string)
    prop.str (Invalid input: expected string, received undefined)
*/
validate(incorrectJSON, customSchema);

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.0.2 - 2025-07-24

Changed

  • Fix vulnerable dependencies

1.0.1 - 2025-07-24

Changed

  • Fix vulnerable dependencies

1.0.0 - 2025-06-04

Changed

  • First release