()
| 377 | cxt.fail$data(codegen_1.or(codegen_1._ `typeof ${fmt} != "object"`, codegen_1._ `${fmt} instanceof RegExp`, codegen_1._ `typeof ${fmt}.compare != "function"`, compareCode(fmt))); |
| 378 | } |
| 379 | function validateFormat() { |
| 380 | const format = fCxt.schema; |
| 381 | const fmtDef = self.formats[format]; |
| 382 | if (!fmtDef || fmtDef === true) |
| 383 | return; |
| 384 | if (typeof fmtDef != "object" || |
| 385 | fmtDef instanceof RegExp || |
| 386 | typeof fmtDef.compare != "function") { |
| 387 | throw new Error(`"${keyword}": format "${format}" does not define "compare" function`); |
| 388 | } |
| 389 | const fmt = gen.scopeValue("formats", { |
| 390 | key: format, |
| 391 | ref: fmtDef, |
| 392 | code: opts.code.formats ? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(format)}` : undefined, |
| 393 | }); |
| 394 | cxt.fail$data(compareCode(fmt)); |
| 395 | } |
| 396 | function compareCode(fmt) { |
| 397 | return codegen_1._ `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`; |
| 398 | } |
no test coverage detected