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:
832 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | const codegen_1 = require("../../compile/codegen");
|
---|
4 | const util_1 = require("../../compile/util");
|
---|
5 | const equal_1 = require("../../runtime/equal");
|
---|
6 | const error = {
|
---|
7 | message: "must be equal to constant",
|
---|
8 | params: ({ schemaCode }) => codegen_1._ `{allowedValue: ${schemaCode}}`,
|
---|
9 | };
|
---|
10 | const def = {
|
---|
11 | keyword: "const",
|
---|
12 | $data: true,
|
---|
13 | error,
|
---|
14 | code(cxt) {
|
---|
15 | const { gen, data, $data, schemaCode, schema } = cxt;
|
---|
16 | if ($data || (schema && typeof schema == "object")) {
|
---|
17 | cxt.fail$data(codegen_1._ `!${util_1.useFunc(gen, equal_1.default)}(${data}, ${schemaCode})`);
|
---|
18 | }
|
---|
19 | else {
|
---|
20 | cxt.fail(codegen_1._ `${schema} !== ${data}`);
|
---|
21 | }
|
---|
22 | },
|
---|
23 | };
|
---|
24 | exports.default = def;
|
---|
25 | //# sourceMappingURL=const.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.