New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zhead/zod

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zhead/zod

The `@zhead/schema` transformed to [Zod](https://github.com/colinhacks/zod].

0.9.6
Source
npm
Version published
Weekly downloads
15
Maintainers
1
Weekly downloads
 
Created
Source

@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.ts
  • metaSchema - <meta> schema. meta.ts
  • metaFlatSchema - flat <meta> schema. meta-flat.ts
  • linkSchema - <link> schema. link.ts
  • scriptSchema - <script> schema. script.ts
  • styleSchema - <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,
// }

FAQs

Package last updated on 13 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts