32 lines
985 B
JavaScript
32 lines
985 B
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const keywords_1 = __importDefault(require("./keywords"));
|
|
const ajvKeywords = (ajv, keyword) => {
|
|
if (Array.isArray(keyword)) {
|
|
for (const k of keyword)
|
|
get(k)(ajv);
|
|
return ajv;
|
|
}
|
|
if (keyword) {
|
|
get(keyword)(ajv);
|
|
return ajv;
|
|
}
|
|
for (keyword in keywords_1.default)
|
|
get(keyword)(ajv);
|
|
return ajv;
|
|
};
|
|
ajvKeywords.get = get;
|
|
function get(keyword) {
|
|
const defFunc = keywords_1.default[keyword];
|
|
if (!defFunc)
|
|
throw new Error("Unknown keyword " + keyword);
|
|
return defFunc;
|
|
}
|
|
exports.default = ajvKeywords;
|
|
module.exports = ajvKeywords;
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
module.exports.default = ajvKeywords;
|
|
//# sourceMappingURL=index.js.map
|