API Reference

matcher

Match strings and arrays against glob patterns with a tiny API and predictable wildcard rules.

Official Documentation ↗
CompatibilityThis documentation covers version v7.0.0. Check the official docs for the latest API surface.

Installation

npmnpm install matcher
pnpmpnpm add matcher

Methods

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.

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.

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.