source: trip-planner-front/node_modules/ajv/dist/vocabularies/jtd/values.js

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: 1.6 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const util_1 = require("../../compile/util");
4const codegen_1 = require("../../compile/codegen");
5const metadata_1 = require("./metadata");
6const nullable_1 = require("./nullable");
7const error_1 = require("./error");
8const def = {
9 keyword: "values",
10 schemaType: "object",
11 error: error_1.typeError("object"),
12 code(cxt) {
13 metadata_1.checkMetadata(cxt);
14 const { gen, data, schema, it } = cxt;
15 if (util_1.alwaysValidSchema(it, schema))
16 return;
17 const [valid, cond] = nullable_1.checkNullableObject(cxt, data);
18 gen.if(cond);
19 gen.assign(valid, validateMap());
20 gen.elseIf(codegen_1.not(valid));
21 cxt.error();
22 gen.endIf();
23 cxt.ok(valid);
24 function validateMap() {
25 const _valid = gen.name("valid");
26 if (it.allErrors) {
27 const validMap = gen.let("valid", true);
28 validateValues(() => gen.assign(validMap, false));
29 return validMap;
30 }
31 gen.var(_valid, true);
32 validateValues(() => gen.break());
33 return _valid;
34 function validateValues(notValid) {
35 gen.forIn("key", data, (key) => {
36 cxt.subschema({
37 keyword: "values",
38 dataProp: key,
39 dataPropType: util_1.Type.Str,
40 }, _valid);
41 gen.if(codegen_1.not(_valid), notValid);
42 });
43 }
44 }
45 },
46};
47exports.default = def;
48//# sourceMappingURL=values.js.map
Note: See TracBrowser for help on using the repository browser.