2 Object.defineProperty(exports, "__esModule", { value: true });
3 const codegen_1 = require("../../compile/codegen");
4 const util_1 = require("../../compile/util");
5 const ucs2length_1 = require("../../runtime/ucs2length");
7 message({ keyword, schemaCode }) {
8 const comp = keyword === "maxLength" ? "more" : "fewer";
9 return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} characters`;
11 params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,
14 keyword: ["maxLength", "minLength"],
20 const { keyword, data, schemaCode, it } = cxt;
21 const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
22 const len = it.opts.unicode === false ? (0, codegen_1._) `${data}.length` : (0, codegen_1._) `${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`;
23 cxt.fail$data((0, codegen_1._) `${len} ${op} ${schemaCode}`);
26 exports.default = def;
27 //# sourceMappingURL=limitLength.js.map