main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
859 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | exports.checkNullableObject = exports.checkNullable = void 0;
|
---|
| 4 | const codegen_1 = require("../../compile/codegen");
|
---|
| 5 | function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) {
|
---|
| 6 | const valid = gen.name("valid");
|
---|
| 7 | if (parentSchema.nullable) {
|
---|
| 8 | gen.let(valid, (0, codegen_1._) `${data} === null`);
|
---|
| 9 | cond = (0, codegen_1.not)(valid);
|
---|
| 10 | }
|
---|
| 11 | else {
|
---|
| 12 | gen.let(valid, false);
|
---|
| 13 | }
|
---|
| 14 | return [valid, cond];
|
---|
| 15 | }
|
---|
| 16 | exports.checkNullable = checkNullable;
|
---|
| 17 | function checkNullableObject(cxt, cond) {
|
---|
| 18 | const [valid, cond_] = checkNullable(cxt, cond);
|
---|
| 19 | return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`];
|
---|
| 20 | }
|
---|
| 21 | exports.checkNullableObject = checkNullableObject;
|
---|
| 22 | //# sourceMappingURL=nullable.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.