UNPKG

853 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
4function schemaHasRulesForType({ schema, self }, type) {
5 const group = self.RULES.types[type];
6 return group && group !== true && shouldUseGroup(schema, group);
7}
8exports.schemaHasRulesForType = schemaHasRulesForType;
9function shouldUseGroup(schema, group) {
10 return group.rules.some((rule) => shouldUseRule(schema, rule));
11}
12exports.shouldUseGroup = shouldUseGroup;
13function shouldUseRule(schema, rule) {
14 var _a;
15 return (schema[rule.keyword] !== undefined ||
16 ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));
17}
18exports.shouldUseRule = shouldUseRule;
19//# sourceMappingURL=applicability.js.map
\No newline at end of file