source: trip-planner-front/node_modules/ajv/dist/vocabularies/jtd/nullable.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 844 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.checkNullableObject = exports.checkNullable = void 0;
4const codegen_1 = require("../../compile/codegen");
5function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) {
6 const valid = gen.name("valid");
7 if (parentSchema.nullable) {
8 gen.let(valid, codegen_1._ `${data} === null`);
9 cond = codegen_1.not(valid);
10 }
11 else {
12 gen.let(valid, false);
13 }
14 return [valid, cond];
15}
16exports.checkNullable = checkNullable;
17function checkNullableObject(cxt, cond) {
18 const [valid, cond_] = checkNullable(cxt, cond);
19 return [valid, codegen_1._ `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`];
20}
21exports.checkNullableObject = checkNullableObject;
22//# sourceMappingURL=nullable.js.map
Note: See TracBrowser for help on using the repository browser.