| 182 | } |
| 183 | |
| 184 | export class UnionRule<T> implements Rule { |
| 185 | predefined: any; |
| 186 | check: CheckFuction; |
| 187 | minimalVersion?: string; |
| 188 | constructor(predefined: T, options: readonly T[], minimalVersion?: string) { |
| 189 | this.predefined = predefined; |
| 190 | this.minimalVersion = minimalVersion; |
| 191 | this.check = function (value: T) { |
| 192 | return options.includes(value); |
| 193 | }; |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * FlexibleUnionRule 允许值为预定义选项之一,或任意字符串(用于自定义翻译器等扩展场景) |
nothing calls this directly
no outgoing calls
no test coverage detected