0.9.9 • Published 2 years ago
@zhead/zod v0.9.9
@zhead/zod
The @zhead/schema
transformed to Zod(https://github.com/colinhacks/zod].
Provides safe parsing and validation of head schema.
Installation
npm install --save-dev @zhead/zod
# Using yarn
yarn add --dev @zhead/zod
API
All exports are Zod based schemas and can be individually used to validate any part of the head schema.
headSchema
-<head>
schema. head.tsmetaSchema
-<meta>
schema. meta.tsmetaFlatSchema
-flat <meta>
schema. meta-flat.tslinkSchema
-<link>
schema. link.tsscriptSchema
-<script>
schema. script.tsstyleSchema
-<style>
schema. style.ts
Example
If you'd like to parse or validate the full head schema you can do the following
import { headSchema } from "@zhead/zod"
headSchema.safeParse({
title: 'Test title',
meta: [
{ description: 'My Description' }
]
})
// {
// "error": [ZodError: [
// {
// "code": "custom",
// "message": "The attribute `content` must be included.",
// "path": [
// "meta",
// 0
// ]
// }
// ]],
// "success": false,
// }
0.9.9
2 years ago
0.9.8
2 years ago
0.9.7
2 years ago
0.9.6
2 years ago
0.9.5
2 years ago
0.9.4
2 years ago
0.9.3
2 years ago
0.9.2
2 years ago
0.9.0
2 years ago
0.9.1
2 years ago
0.8.5
2 years ago
0.8.4
2 years ago
0.8.3
2 years ago
0.8.2
2 years ago
0.8.1
2 years ago
0.8.0
2 years ago
0.7.4
2 years ago
0.7.3
2 years ago
0.7.2
2 years ago
0.7.1
2 years ago
0.7.0
2 years ago
0.6.2
2 years ago
0.6.1
2 years ago
0.6.0
2 years ago
0.5.3
2 years ago
0.5.2
2 years ago
0.5.1
2 years ago
0.5.0
2 years ago
0.4.1
2 years ago
0.4.0
2 years ago
0.3.2
2 years ago
0.3.1
2 years ago
0.3.0
2 years ago
0.2.4
2 years ago
0.2.3
2 years ago
0.2.2
2 years ago
0.2.0
2 years ago