Constructors
constructor
- new Matcher(pattern?: Pattern, baseDir?: string, ignoreCase?: boolean): Matcher
-
Parameters
-
Optional pattern: Pattern
-
Default value baseDir: string = ""
-
Default value ignoreCase: boolean = isCaseInsensitive
Properties
ignoreCase
ignoreCase: boolean
Accessors
base
-
Returns string
Methods
baseOf
- baseOf(path: string): string
-
Parameters
Returns string
如果没有匹配的基路径则返回空
exclude
- exclude(pattern: Pattern | undefined): void
getBases
-
Returns string[]
include
- include(pattern: Pattern | undefined): void
relative
- relative(path: string): string
-
Parameters
Returns string
如果没有匹配的基路径则返回原路径
test
- test(path: string, ...args: readonly, any: any, __namedParameters: []): boolean
-
Parameters
-
path: string
-
Rest ...args: readonly
-
any: any
-
__namedParameters: []
Returns boolean
表示一个路径匹配器
const matcher = new Matcher() matcher.include(".js") matcher.include(".jsx") matcher.exclude("y.js") matcher.test("x.js") // true matcher.test("x.jsx") // true matcher.test("y.js") // false