mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Docs: Update benchmark for openrouter/sherlock-dash-alpha
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
async function validateJSON(data, schema) {
|
||||
const { default: Ajv } = await import('https://cdn.skypack.dev/ajv@8');
|
||||
const ajv = new Ajv({ allErrors: true, verbose: true });
|
||||
const validate = ajv.compile(schema);
|
||||
const valid = validate(data);
|
||||
return {
|
||||
valid,
|
||||
errors: valid ? [] : ajv.errors?.map(e =>
|
||||
`${e.instancePath || 'data'}: ${e.message} (${e.params?.type || e.schema})`
|
||||
) || []
|
||||
};
|
||||
}
|
||||
export default validateJSON;
|
||||
Reference in New Issue
Block a user