X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Ftable%2Fnode_modules%2Fajv%2Flib%2Fvocabularies%2Fformat%2Fformat.ts;h=4b1c13e764375dbb4dff021426a377f8103ab54f;hp=47175818c1449bc66cdd74d2b8c7a8df049ea171;hb=3be0a9efc698a9570a44456009afc6014812625a;hpb=d2f432cc757f42f0318fdddcab8c00b240d47088 diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/table/node_modules/ajv/lib/vocabularies/format/format.ts b/.config/coc/extensions/node_modules/coc-prettier/node_modules/table/node_modules/ajv/lib/vocabularies/format/format.ts index 47175818..4b1c13e7 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/table/node_modules/ajv/lib/vocabularies/format/format.ts +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/table/node_modules/ajv/lib/vocabularies/format/format.ts @@ -7,7 +7,7 @@ import type { ErrorObject, } from "../../types" import type {KeywordCxt} from "../../compile/validate" -import {_, str, nil, or, Code, getProperty} from "../../compile/codegen" +import {_, str, nil, or, Code, getProperty, regexpCode} from "../../compile/codegen" type FormatValidate = | FormatValidator @@ -92,11 +92,13 @@ const def: CodeKeywordDefinition = { } function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] { - const fmt = gen.scopeValue("formats", { - key: schema, - ref: fmtDef, - code: opts.code.formats ? _`${opts.code.formats}${getProperty(schema)}` : undefined, - }) + const code = + fmtDef instanceof RegExp + ? regexpCode(fmtDef) + : opts.code.formats + ? _`${opts.code.formats}${getProperty(schema)}` + : undefined + const fmt = gen.scopeValue("formats", {key: schema, ref: fmtDef, code}) if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { return [fmtDef.type || "string", fmtDef.validate, _`${fmt}.validate`] }