mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-17 09:17:53 +00:00
7 lines
272 B
JavaScript
7 lines
272 B
JavaScript
const validateJSON = async (d, s) => {
|
|
const { default: A } = await import('https://esm.sh/ajv@8.12.0')
|
|
const v = new A({ allErrors: true }).compile(s)
|
|
const b = v(d)
|
|
return { valid: b, errors: b ? [] : v.errors.map(e => e.message) }
|
|
}
|
|
export default validateJSON; |