mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-19 10:14:51 +00:00
Docs: Update Gemini benchmark results
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
const validateJSON = async (data, schema) => {
|
||||
const { default: Ajv } = await import('https://esm.sh/ajv@8')
|
||||
const validate = new Ajv({ allErrors: true }).compile(schema)
|
||||
const valid = validate(data)
|
||||
return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) }
|
||||
try {
|
||||
const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1')
|
||||
const ajv = new Ajv({ allErrors: !0 })
|
||||
const validate = ajv.compile(schema)
|
||||
const valid = validate(data)
|
||||
return {
|
||||
valid,
|
||||
errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim())
|
||||
}
|
||||
} catch (e) {
|
||||
return { valid: !1, errors: [e.message] }
|
||||
}
|
||||
}
|
||||
export default validateJSON;
|
||||
Reference in New Issue
Block a user