1.1.0 • Published 2 years ago
@zhead/validation v1.1.0
@zhead/validation
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/validation
# Using yarn
yarn add --dev @zhead/validation
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/validation"
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,
// }
1.1.0
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
1.0.0-beta.13
3 years ago
1.0.0-beta.12
3 years ago
1.0.0-beta.11
3 years ago
1.0.0-beta.10
3 years ago
1.0.0-beta.8
3 years ago
1.0.0-beta.7
3 years ago
1.0.0-beta.6
3 years ago
1.0.0-beta.5
3 years ago
1.0.0-beta.4
3 years ago
1.0.0-beta.3
3 years ago