applicability.js 845 B

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