$ show isaacs/node-glob
This repository is a high-performance, bash-compatible glob pattern matching library for JavaScript/TypeScript. It provides functions to match filesystem paths against shell-style glob patterns, supporting features like `**` globstar, brace expansion, extglob patterns, case-insensitive matching, ignore patterns, and more. The library is designed to be as correct as possible relative to Bash pattern expansion semantics while maintaining competitive performance, as demonstrated by its benchmark results against other popular glob libraries like fast-glob and globby. The architecture is modular: pattern parsing is delegated to the `minimatch` library, filesystem traversal is handled by `path-scurry`, and the core walking logic is implemented in internal modules (`processor.ts`, `walker.ts`). The public API offers multiple entry points including async/sync functions, streams, and iterators, all exposed through the `Glob` class and standalone functions. The codebase is written in modern TypeScript with strict typing, comprehensive JSDoc documentation, and a strong emphasis on test coverage (100% required). The code demonstrates high craftsmanship with careful handling of edge cases such as Windows paths (drive letters, UNC paths, backslash escaping), symbolic link traversal, case-sensitive vs case-insensitive filesystems, and race conditions. The `Ignore` class in `src/ignore.ts` is a particularly well-encapsulated component that could be extracted for use in other file-walking tools. Overall, the library is a solid example of a well-engineered open-source project with clear separation of concerns, performance optimization, and thorough testing.
The LLM identified 1 files worth highlighting for reuse:
The `Ignore` class provides a self-contained utility for filtering filesystem paths based on glob patterns. It accepts an array of ignore patterns (strings) and exposes `ignored(path)` and `childrenIgnored(path)` methods to determine if a path should be excluded or if its children should be skipped. It handles both relative and absolute patterns, supports `/**` to ignore all children, and uses `minimatch` for efficient pattern matching. The class is well-encapsulated, depends only on `minimatch` and `path-scurry`'s `Path` type, and could be extracted into a standalone library for file filtering in other projects.