matcher
Match strings and arrays against glob patterns with a tiny API and predictable wildcard rules.
Official Documentation ↗v7.0.0. Check the official docs for the latest API surface.Installation
npm install matcherpnpm add matcherMethods
No methods match this filter.
matcher answers a narrow question: does this string, or any string in this array, match one of these glob patterns? It is intentionally smaller than a full glob engine.
When to use it
Use matcher for extension filters, allow lists, and simple route or file selection. Switch to minimatch or picomatch when negation, extglobs, or path-segment semantics matter.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/matcher@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:52.222Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- An input string will be omitted if there is no pattern at all, if it matches a negated pattern, or if there are non-negated patterns and it fails to match them: all of them when allPatterns is set, at least one otherwise. (https://cdn.jsdelivr.net/gh/sindresorhus/matcher@latest/readme.md)
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/matcher@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:52.222Z.
- A \ escapes the character after it, so * matches a literal * and \ matches a literal . (https://cdn.jsdelivr.net/gh/sindresorhus/matcher@latest/readme.md)
FAQ
- Which wildcard syntax is supported?
- The glob subset used by minimatch: *, ?, character ranges such as [a-z], and brace expansion. Negation with a leading ! is not supported.
- Does an array input need every pattern?
- No. isMatch returns true when any input string matches any pattern, which is useful for filtering file lists by extension.
- How does it differ from minimatch?
- matcher is a small, dependency-light matcher for simple globs. Use minimatch when you need negation, extglobs, or full path semantics.
- Is matching case-sensitive by default?
- No. Matching ignores case unless you pass { caseSensitive: true }; set it explicitly when filenames are case-significant.
Report a problem with this API docOpens a pre-filled issue on GitHub.