has-ansi is a lightweight npm package that checks if a string contains ANSI escape codes. It's a crucial utility for applications that handle terminal output, allowing developers to easily determine whether a string includes color codes or other formatting instructions intended for a console. Using has-ansi enables appropriate handling of text, preventing garbled output when displaying logs or messages in environments that don't support ANSI codes, ensuring clean and consistent presentation across different platforms.
The has-ansi npm package saw initial releases in 2014-2015, with occasional updates. Major versions were released roughly every 1-2 years (v2 in 2015, v3 in 2017, v4 in 2019, v5 in 2021, and v6 in 2024). The frequency of releases has been sporadic. No releases have occurred from August 2024 until today, September 5, 2025.
Has-ansi npm package downloads show growth from March 2024 to August 2025, peaking in July 2025 at 73.2 million. There was a significant surge in June and July of 2025. September 2025 data is incomplete, showing 8.6 million downloads so far. Overall downloads have increased over time, but can be volatile.