Docs: Update benchmark results

This commit is contained in:
github-actions[bot]
2025-11-07 22:07:45 +00:00
parent b5f81c6e8a
commit 1687dca49c
42 changed files with 784 additions and 847 deletions
@@ -1,15 +1,21 @@
async function validateJSON(data, schema) {
const {default: Ajv} = await import('https://cdn.jsdelivr.net/npm/ajv@8/dist/ajv.min.js')
const ajv = new Ajv({allErrors:true, strict:false})
const validate = ajv.compile(schema)
const valid = validate(data)
if (valid) return {valid:true, errors:[]}
const errors = (validate.errors || []).map(e => {
const path = (e.instancePath || e.dataPath || '') || (e.schemaPath || '')
const msg = e.message || 'Invalid value'
const params = e.params ? JSON.stringify(e.params) : ''
return [path, msg, params].filter(Boolean).join(' - ')
})
return {valid:false, errors}
const { default: Ajv } = await import('https://cdn.skypack.dev/ajv@8?min');
const { default: addFormats } = await import('https://cdn.skypack.dev/ajv-formats@2?min');
const ajv = new Ajv({ allErrors: true, strict: false });
addFormats(ajv);
const compile = s => {
const c = ajv.compile(s);
return d => ({ ok: c(d), errs: c.errors || [] });
};
const run = compile(schema);
const r = run(data);
if (r.ok) return { valid: true, errors: [] };
const errors = r.errs.map(e => {
const p = e.instancePath || e.dataPath || '';
const loc = p || e.schemaPath || '';
const msg = e.message || 'Invalid value';
return loc ? loc + ' ' + msg : msg;
});
return { valid: false, errors };
}
export default validateJSON;