Docs: Update benchmark for stealth/union-alpha EFF:high

This commit is contained in:
github-actions[bot]
2026-09-16 16:14:56 +00:00
parent ddcf1af44b
commit 0f704a2f22
12 changed files with 516 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
async function validateJSON(data, schema) {
if (!schema || typeof schema !== "object" || Array.isArray(schema))
throw new TypeError("Schema must be a JSON Schema object.");
const [{ default: Ajv }, { default: addFormats }] = await Promise.all([
import("https://esm.sh/ajv@8.17.1"),
import("https://esm.sh/ajv-formats@3.0.1?deps=ajv@8.17.1")
]);
const ajv = new Ajv({ allErrors: true, strict: false });
addFormats(ajv);
const validate = ajv.compile(schema);
if (validate.$async)
throw new TypeError("Asynchronous schema extensions are not supported.");
const valid = validate(data);
return {
valid,
errors: valid
? []
: (validate.errors ?? []).map(
({ instancePath, message }) => `${instancePath || "/"}: ${message}`
)
};
}
export default validateJSON;
// Generation time: 99.796s
// Result: PASS