xmitter-11ty/_data/eleventyDataSchema.js
2024-09-24 12:18:16 -05:00

14 lines
308 B
JavaScript

import { z } from "zod";
import { fromZodError } from 'zod-validation-error';
export default function(data) {
// Draft content, validate `draft` front matter
let result = z.object({
draft: z.boolean().or(z.undefined()),
}).safeParse(data);
if(result.error) {
throw fromZodError(result.error);
}
}