{"repo":"HiDeoo/zod-matter","free":true,"listed":false,"github":"https://github.com/HiDeoo/zod-matter","clone":"git clone https://github.com/HiDeoo/zod-matter.git","description":"Typesafe front matter","language":"TypeScript","stars":30,"topics":["front-matter","frontmatter","gray-matter","markdown","matter","mdx","typesafe","typescript","yaml","zod"],"license":"MIT","category":"machine-learning","readme_excerpt":"zod-matter 🏷️ Typesafe front matter Features zod-matter is a tiny wrapper for gray-matter and Zod to parse and validate front matter with static type inference. gray-matter is a great package to parse front matter but provides no validation or type safety. This package exposes an API adding a schema parameter to validate front matter data using Zod. This can be particularly useful to parse & validate front matter for user generated Markdown or MDX files for example. Installation Install zod-matter and its peer dependencies with your favorite package manager, e.g.: Usage parse Extracts and parses front matter according to the given Zod schema. Parameters - input : The string, buffer or object with a content property to parse. - schema : The Zod schema to use to parse the front matter. - options : Optionally, the gray-matter options to use. Return value A file object with the same properties of a gray-matter file object but with a data property of the type inferred from the given Zod schema. If the front matter data is invalid, a ZodError will be thrown. read Extracts and parses front matter from a file according to the given Zod schema. Parameters - path : The path to the file to read and parse. - schema : The Zod schema to use to parse the front matter. - options : Optionally, the gray-matter options to use. Return value A file object with the same properties of a gray-matter file object but with a data property of the type inferred from the given Zod schema. If the front ma","default_branch":null,"files":null,"tree":[],"storefront":"/r/HiDeoo","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/HiDeoo/zod-matter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}