mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-16 16:57:53 +00:00
6 lines
258 B
JavaScript
6 lines
258 B
JavaScript
const validateJSON = async (d, s) => {
|
|
const { default: A } = await import('https://esm.sh/ajv@8')
|
|
const v = new A({ allErrors: !0 }).compile(s), r = v(d)
|
|
return { valid: r, errors: r ? [] : v.errors.map(e => e.message) }
|
|
}
|
|
export default validateJSON; |