source: trip-planner-front/node_modules/ajv/dist/vocabularies/validation/limitNumber.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1021 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const codegen_1 = require("../../compile/codegen");
4const ops = codegen_1.operators;
5const KWDs = {
6 maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
7 minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
8 exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
9 exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE },
10};
11const error = {
12 message: ({ keyword, schemaCode }) => codegen_1.str `must be ${KWDs[keyword].okStr} ${schemaCode}`,
13 params: ({ keyword, schemaCode }) => codegen_1._ `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,
14};
15const def = {
16 keyword: Object.keys(KWDs),
17 type: "number",
18 schemaType: "number",
19 $data: true,
20 error,
21 code(cxt) {
22 const { keyword, data, schemaCode } = cxt;
23 cxt.fail$data(codegen_1._ `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
24 },
25};
26exports.default = def;
27//# sourceMappingURL=limitNumber.js.map
Note: See TracBrowser for help on using the repository browser.