mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-07-18 05:45:46 +00:00
Docs: Update benchmark for anthropic/claude-sonnet-5 EFF:high
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
async function validateJSON(data, schema) {
|
||||
const { default: Ajv } = await import('https://cdn.jsdelivr.net/npm/ajv@8/+esm');
|
||||
|
||||
const ajv = new Ajv({ allErrors: true, strict: false });
|
||||
const validate = ajv.compile(schema);
|
||||
const valid = validate(data);
|
||||
|
||||
const errors = valid
|
||||
? []
|
||||
: validate.errors.map(({ instancePath, message, params }) => {
|
||||
const path = instancePath || '/';
|
||||
const extra = params?.missingProperty
|
||||
? ` (missing: ${params.missingProperty})`
|
||||
: '';
|
||||
return `${path}: ${message}${extra}`;
|
||||
});
|
||||
|
||||
return { valid, errors };
|
||||
}
|
||||
export default validateJSON;
|
||||
// Generation time: 6.311s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user