applicability.js 853 B

12345678910111213141516171819
  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 ||
  16. ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));
  17. }
  18. exports.shouldUseRule = shouldUseRule;
  19. //# sourceMappingURL=applicability.js.map