MCPcopy Create free account
hub / github.com/json-editor/json-editor / getFormat

Function getFormat

docs/scripts/ajv-validator.js:6193–6204  ·  view source on GitHub ↗
(fmtDef)

Source from the content-addressed store, hash-verified

6191 }
6192 }
6193 function getFormat(fmtDef) {
6194 const code = fmtDef instanceof RegExp
6195 ? (0, codegen_1.regexpCode)(fmtDef)
6196 : opts.code.formats
6197 ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}`
6198 : undefined;
6199 const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
6200 if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
6201 return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`];
6202 }
6203 return ["string", fmtDef, fmt];
6204 }
6205 function validCondition() {
6206 if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) {
6207 if (!schemaEnv.$async)

Callers 1

validateFormatFunction · 0.85

Calls 1

scopeValueMethod · 0.80

Tested by

no test coverage detected