/** * * 用来匹配一个字符串是否满足某种规则 * * * * matcher(["a"]).test("a") // true,严格匹配 * matcher(["a","b"]).test("a") // true,严格匹配 * matcher(["!a","b"]).test("a") // false 严格匹配 * matcher(["!a","b"]).test("x") // false, 指定了肯定匹配和否定匹配时,!a代表不匹配a, * matcher(["*"]) // 任意字符直到某个指定的字符结束 * matcher(["**"]) // 匹配任意字符,使用.*正则 * matcher(["?"]) // ?代表单个字符 * * * */ interface MatcherOptions { ignoreCase?: boolean; divider?: string; charset?: string; } declare class Matcher { rules: [RegExp, boolean][]; constructor(rules: string | (RegExp | string)[] | RegExp, options?: MatcherOptions); test(str: string): boolean; } export { Matcher, type MatcherOptions };