Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
914 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | const util_1 = require("../../compile/util");
|
---|
4 | const code_1 = require("../code");
|
---|
5 | const codegen_1 = require("../../compile/codegen");
|
---|
6 | const metadata_1 = require("./metadata");
|
---|
7 | const nullable_1 = require("./nullable");
|
---|
8 | const error_1 = require("./error");
|
---|
9 | const def = {
|
---|
10 | keyword: "elements",
|
---|
11 | schemaType: "object",
|
---|
12 | error: error_1.typeError("array"),
|
---|
13 | code(cxt) {
|
---|
14 | metadata_1.checkMetadata(cxt);
|
---|
15 | const { gen, data, schema, it } = cxt;
|
---|
16 | if (util_1.alwaysValidSchema(it, schema))
|
---|
17 | return;
|
---|
18 | const [valid] = nullable_1.checkNullable(cxt);
|
---|
19 | gen.if(codegen_1.not(valid), () => gen.if(codegen_1._ `Array.isArray(${data})`, () => gen.assign(valid, code_1.validateArray(cxt)), () => cxt.error()));
|
---|
20 | cxt.ok(valid);
|
---|
21 | },
|
---|
22 | };
|
---|
23 | exports.default = def;
|
---|
24 | //# sourceMappingURL=elements.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.