| | |
| | | /** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */ |
| | | |
| | | /** |
| | | * Defines the keys of types type used by this module. |
| | | * @template T |
| | | * @template {T[keyof T]} V |
| | | * @typedef {import("./RuleSetCompiler").KeysOfTypes<T, V>} KeysOfTypes |
| | |
| | | |
| | | class BasicMatcherRulePlugin { |
| | | /** |
| | | * Creates an instance of BasicMatcherRulePlugin. |
| | | * @param {BasicMatcherRuleKeys} ruleProperty the rule property |
| | | * @param {string=} dataProperty the data property |
| | | * @param {boolean=} invert if true, inverts the condition |
| | | */ |
| | | constructor(ruleProperty, dataProperty, invert) { |
| | | /** @type {BasicMatcherRuleKeys} */ |
| | | this.ruleProperty = ruleProperty; |
| | | /** @type {string | BasicMatcherRuleKeys} */ |
| | | this.dataProperty = dataProperty || ruleProperty; |
| | | /** @type {boolean} */ |
| | | this.invert = invert || false; |
| | | } |
| | | |
| | | /** |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler |
| | | * @returns {void} |
| | | */ |