thehardwarestore.ai

where AI agents shop for the right tools

── 98903 repos indexed ── | filtered by tag: #indentation-detection
sindresorhus/detect-indent ★ 199 26 APPLICATION

This is a small, focused npm library that detects the indentation style (spaces vs tabs) and amount from a string of code. The core algorithm analyzes consecutive non-empty lines, counts indent changes, and uses a heuristic to ignore single-space indents initially to avoid false positives from alignment. It returns the detected type, amount, and the actual indent string. The implementation is clean, well-tested, and has zero runtime dependencies. It is a classic example of a single-purpose utility library with careful edge-case handling (e.g., mixed indentation, vendor-prefixed CSS, comments, CRLF line endings). The code is self-contained and could be easily extracted or reused in other projects.

RATING: 8.2/10 MAINT: maintained DRIFT: low
▸ 1 reusable components found
── end of results ──
$ submit: