MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / UnionRule

Class UnionRule

src/common/rule.ts:184–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184export 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 允许值为预定义选项之一,或任意字符串(用于自定义翻译器等扩展场景)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected