1.1.0 • Published 1 year 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
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago
1.0.0-beta.13
2 years ago
1.0.0-beta.12
2 years ago
1.0.0-beta.11
2 years ago
1.0.0-beta.10
2 years ago
1.0.0-beta.8
2 years ago
1.0.0-beta.7
2 years ago
1.0.0-beta.6
2 years ago
1.0.0-beta.5
2 years ago
1.0.0-beta.4
2 years ago
1.0.0-beta.3
2 years ago