mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-16 08:57:52 +00:00
9 lines
319 B
JavaScript
9 lines
319 B
JavaScript
async function validateJSON(json, schema) {
|
|
const { default: Ajv } = await import('https://esm.sh/ajv')
|
|
const ajv = new Ajv()
|
|
const valid = ajv.validate(schema, json)
|
|
return { valid, errors: valid ? [] : ajv.errors.map(e => e.message) }
|
|
}
|
|
export default validateJSON;
|
|
// Generation time: 28.047s
|
|
// Result: PASS
|