mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-17 17:27:53 +00:00
6 lines
248 B
JavaScript
6 lines
248 B
JavaScript
const validateJSON = async (data, schema) => {
|
|
const { default: Ajv } = await import('https://esm.sh/ajv@8')
|
|
const v = new Ajv({ allErrors: !0 }).compile(schema)
|
|
return { valid: v(data), errors: v.errors || [] }
|
|
}
|
|
export default validateJSON; |