mirror of
https://github.com/lynchmarkHQ/lynchmark.com.git
synced 2026-10-11 23:05:21 +00:00
13 lines
373 B
JavaScript
13 lines
373 B
JavaScript
export const validateJSON = async (d, s) => {
|
|
const { default: A } = await import("https://esm.sh/ajv@8");
|
|
const v = new A({ allErrors: true }).compile(s);
|
|
const k = v(d);
|
|
|
|
return {
|
|
valid: k,
|
|
errors: k ? [] : v.errors.map(e => `${e.instancePath || "/"} ${e.message}`.trim())
|
|
};
|
|
};
|
|
export default validateJSON;
|
|
// Generation time: 16.896s
|
|
// Result: PASS
|