Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
837 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | const codegen_1 = require("../../compile/codegen");
|
---|
4 | const error = {
|
---|
5 | message({ keyword, schemaCode }) {
|
---|
6 | const comp = keyword === "maxItems" ? "more" : "fewer";
|
---|
7 | return codegen_1.str `must NOT have ${comp} than ${schemaCode} items`;
|
---|
8 | },
|
---|
9 | params: ({ schemaCode }) => codegen_1._ `{limit: ${schemaCode}}`,
|
---|
10 | };
|
---|
11 | const def = {
|
---|
12 | keyword: ["maxItems", "minItems"],
|
---|
13 | type: "array",
|
---|
14 | schemaType: "number",
|
---|
15 | $data: true,
|
---|
16 | error,
|
---|
17 | code(cxt) {
|
---|
18 | const { keyword, data, schemaCode } = cxt;
|
---|
19 | const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
|
---|
20 | cxt.fail$data(codegen_1._ `${data}.length ${op} ${schemaCode}`);
|
---|
21 | },
|
---|
22 | };
|
---|
23 | exports.default = def;
|
---|
24 | //# sourceMappingURL=limitItems.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.