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: (0, error_1.typeError)("array"),
|
13 | code(cxt) {
|
14 | (0, metadata_1.checkMetadata)(cxt);
|
15 | const { gen, data, schema, it } = cxt;
|
16 | if ((0, util_1.alwaysValidSchema)(it, schema))
|
17 | return;
|
18 | const [valid] = (0, nullable_1.checkNullable)(cxt);
|
19 | gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error()));
|
20 | cxt.ok(valid);
|
21 | },
|
22 | };
|
23 | exports.default = def;
|
24 |
|
\ | No newline at end of file |