xmitter-11ty/_data/eleventyDataSchema.js

14 lines
308 B
JavaScript
Raw Permalink Normal View History

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);
}
}