Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
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 error = {
|
---|
6 | message: "property name must be valid",
|
---|
7 | params: ({ params }) => codegen_1._ `{propertyName: ${params.propertyName}}`,
|
---|
8 | };
|
---|
9 | const def = {
|
---|
10 | keyword: "propertyNames",
|
---|
11 | type: "object",
|
---|
12 | schemaType: ["object", "boolean"],
|
---|
13 | error,
|
---|
14 | code(cxt) {
|
---|
15 | const { gen, schema, data, it } = cxt;
|
---|
16 | if (util_1.alwaysValidSchema(it, schema))
|
---|
17 | return;
|
---|
18 | const valid = gen.name("valid");
|
---|
19 | gen.forIn("key", data, (key) => {
|
---|
20 | cxt.setParams({ propertyName: key });
|
---|
21 | cxt.subschema({
|
---|
22 | keyword: "propertyNames",
|
---|
23 | data: key,
|
---|
24 | dataTypes: ["string"],
|
---|
25 | propertyName: key,
|
---|
26 | compositeRule: true,
|
---|
27 | }, valid);
|
---|
28 | gen.if(codegen_1.not(valid), () => {
|
---|
29 | cxt.error(true);
|
---|
30 | if (!it.allErrors)
|
---|
31 | gen.break();
|
---|
32 | });
|
---|
33 | });
|
---|
34 | cxt.ok(valid);
|
---|
35 | },
|
---|
36 | };
|
---|
37 | exports.default = def;
|
---|
38 | //# sourceMappingURL=propertyNames.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.