Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1010 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | const core_1 = require("../core");
|
---|
4 | const _1 = require(".");
|
---|
5 | const requireFromString = require("require-from-string");
|
---|
6 | class AjvPack {
|
---|
7 | constructor(ajv) {
|
---|
8 | this.ajv = ajv;
|
---|
9 | }
|
---|
10 | validate(schemaKeyRef, data) {
|
---|
11 | return core_1.default.prototype.validate.call(this, schemaKeyRef, data);
|
---|
12 | }
|
---|
13 | compile(schema, meta) {
|
---|
14 | return this.getStandalone(this.ajv.compile(schema, meta));
|
---|
15 | }
|
---|
16 | getSchema(keyRef) {
|
---|
17 | const v = this.ajv.getSchema(keyRef);
|
---|
18 | if (!v)
|
---|
19 | return undefined;
|
---|
20 | return this.getStandalone(v);
|
---|
21 | }
|
---|
22 | getStandalone(v) {
|
---|
23 | return requireFromString(_1.default(this.ajv, v));
|
---|
24 | }
|
---|
25 | addSchema(...args) {
|
---|
26 | this.ajv.addSchema.call(this.ajv, ...args);
|
---|
27 | return this;
|
---|
28 | }
|
---|
29 | addKeyword(...args) {
|
---|
30 | this.ajv.addKeyword.call(this.ajv, ...args);
|
---|
31 | return this;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | exports.default = AjvPack;
|
---|
35 | //# sourceMappingURL=instance.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.