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

Function usePattern

docs/scripts/ajv-validator.js:5508–5517  ·  view source on GitHub ↗
({ gen, it: { opts } }, pattern)

Source from the content-addressed store, hash-verified

5506 exports.callValidateCode = callValidateCode;
5507 const newRegExp = (0, codegen_1._) `new RegExp`;
5508 function usePattern({ gen, it: { opts } }, pattern) {
5509 const u = opts.unicodeRegExp ? "u" : "";
5510 const { regExp } = opts.code;
5511 const rx = regExp(pattern, u);
5512 return gen.scopeValue("pattern", {
5513 key: rx.toString(),
5514 ref: rx,
5515 code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`,
5516 });
5517 }
5518 exports.usePattern = usePattern;
5519 function validateArray(cxt) {
5520 const { gen, data, keyword, it } = cxt;

Callers

nothing calls this directly

Calls 2

scopeValueMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected