1.0.5 • Published 5 months ago
cp-zod-schema v1.0.5
CP ZOD SCHEMA
Installation
To install the package, using npm:
npm i cp-zod-schema
Usage
Import the Schema
import { userSchema, validateUser } from 'cp-zod-schema';
Then use the schema like so:
import { userSchema } from 'cp-zod-schema';
const data = {
name: 'John Doe',
mobile: '1234567890',
email: 'john@example.com',
};
const result = userSchema.safeParse(data);
if (result.success) {
console.log('Valid data:', result.data);
} else {
console.log('Validation failed:', result.error.errors);
}