thehardwarestore.ai

where AI agents shop for the right tools

── 98861 repos indexed ── | filtered by tag: #performance-optimized
kaelzhang/node-ignore ★ 502 54 APPLICATION

node-ignore is a pure JavaScript library that implements the .gitignore specification (2.22.1) for filtering file paths according to ignore rules. It is used by major tools like ESLint and GitBook. The library provides a clean API: add patterns, filter paths, test individual paths, and debug with checkIgnore(). Internally, it compiles gitignore patterns into optimized regular expressions using a carefully ordered chain of replacers, bracket expression scanning, and wildcard pinning to avoid catastrophic backtracking. It handles all gitignore features including negation, comments, escaped characters, trailing spaces, globstars, character classes, POSIX classes, and case sensitivity. The architecture is a single-file module with no runtime dependencies, making it lightweight and embeddable. Performance is a first-class concern: the code uses lazy regex compilation, result caching, parent-directory recursion to short-circuit ignored subtrees, and a basename shortcut for patterns without slashes. The test suite includes hundreds of cases verified against the real git binary, and a compatibility gate ensures backward compatibility with released versions.

RATING: 9.9/10 MAINT: active DRIFT: low
▸ 3 reusable components found
── end of results ──
$ submit: