Micromatch
Fast, POSIX-compliant glob matching for Node.js — the drop-in replacement for minimatch and multimatch.
Repository Health
Technical Analysis
Micromatch is a highly optimized wildcard and glob matching library for JavaScript and Node.js. It matches lists of strings against one or more glob patterns and is built to be a faster, more accurate drop-in replacement for minimatch and multimatch, supporting extglobs, brace expansion, POSIX character classes, and regex character classes and groups.
It underpins file-filtering logic across a huge share of the JavaScript build and tooling ecosystem — webpack, Babel, Jest, Yarn, ESLint, stylelint, nyc, and Ava all depend on it to decide which files a glob pattern includes or excludes, so its correctness and performance directly affect the reliability of those tools.
What You Get
- A single default export
micromatch(list, patterns, options)that filters a list of strings against one or more glob patterns, including negated patterns (!foo/*.js) - Boolean matching helpers —
isMatch,some,every,all,contains— for testing single strings or lists without building an intermediate result array - A
matcher(pattern, options)factory that compiles a pattern once into a reusable predicate function for repeated matching in hot paths - Extended globbing support: extglobs (
+(x|y),!(a|b)), POSIX bracket expressions ([[:alpha:][:digit:]]), regex character classes, and regex logical-or groups - Brace expansion (
foo/{1..5}.md,bar/{a,b,c}.js) delegated to the companionbraceslibrary, withbraces()andbraceExpand()exposed directly - Utility functions for regex generation and introspection:
makeRe,scan,parse, andcapturefor extracting captured groups from a match
Common Use Cases
- Filtering which files a build tool (bundler, linter, test runner) should include or exclude based on glob patterns in config
- Implementing
.gitignore-style include/exclude rules for CLI tools that walk a file tree - Filtering object keys or arbitrary string lists by wildcard pattern with
matchKeysandnot - Compiling a glob pattern to a native
RegExpviamakeRefor use in custom matching pipelines
Under The Hood
Architecture — Micromatch’s own index.js is a thin orchestration layer, not the pattern-matching engine itself: it delegates regex compilation and single-pattern matching to picomatch, and brace expansion to the braces library, while owning the higher-level concerns of multi-pattern list filtering, negation semantics, and result deduplication. The core micromatch() function iterates each pattern, builds a picomatch matcher for it, and uses Set-based keep/omit accumulators to correctly resolve mixed positive and negated patterns (e.g. ['*.js', '!foo.js']) into a single filtered list, falling back to nonull/nullglob/failglob options when nothing matches. The rest of the public API (isMatch, some, every, all, contains, matchKeys, capture, makeRe, scan, parse) are largely convenience wrappers that reshape calls into picomatch invocations for different call signatures. Tech Stack — The package has exactly two runtime dependencies, braces@^3.0.3 for brace expansion and picomatch@^2.3.1 for pattern-to-regex compilation, and ships as a single unbuilt index.js file (per package.json’s files field) with no bundler or transpilation step — the published code is the source code. Development tooling is minimal: mocha for the test runner, minimatch as a devDependency for parity testing, and gulp-format-md for generating the README via the verb toolchain referenced in package.json. There is no TypeScript in the repo itself; type definitions are maintained externally via DefinitelyTyped. Code Quality — The test suite is extensive: 36 test files under test/, including per-method API tests (api.isMatch.js, api.match.js, api.some.js, etc.) and a dedicated bash.spec.js/bash.js pair that runs micromatch against Bash’s own glob-matching spec fixtures, backing the README’s claim of over 5,000 test assertions. Source code is a single, consistently styled file with JSDoc comments on every exported method, explicit TypeError throws for invalid input types (e.g. contains and all reject non-string input), and no dead or speculative code paths. API Design — The API mirrors minimatch and multimatch’s familiar call shapes closely enough that the README documents direct drop-in replacements for both (mm.isMatch() for minimatch(), mm.match() for minimatch.match()), minimizing migration friction. Every method follows the same (subject, patterns, options) argument order, and the boolean-returning helpers (isMatch, some, every, all, contains) give callers a predictable vocabulary for different matching needs without having to post-process array results.
Used by 13 apps in this directory
React Cosmos
Developer Tools
An open-source sandbox for developing and testing React and React Native UI components in isolation, with pluggable bundler support for Vite and Webpack.
Sourcebot
AI Code Assistants · Developer Tools · Search
A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.
strapi
CMS
Open-source headless CMS that auto-generates REST and GraphQL APIs from your content models, with a fully customizable admin panel you control.
TinaCMS
CMS
An open-source, Git-backed headless CMS that gives editors a live visual editing UI over Markdown, MDX, JSON, and YAML content while developers keep everything in version control.