Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has-ansi

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-ansi

Check if a string has ANSI escape codes

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12M
decreased by-14.62%
Maintainers
2
Weekly downloads
 
Created

What is has-ansi?

The has-ansi npm package is used to check if a string contains ANSI escape codes. These codes are often used to format output in terminal applications, such as changing colors, styles, or other text attributes. This package provides a simple way to detect the presence of these codes in a given string.

What are has-ansi's main functionalities?

Check for ANSI escape codes in a string

This feature allows you to check if a string contains ANSI escape codes. The function `hasAnsi` returns `true` if the string contains any ANSI escape codes, and `false` otherwise. This is useful for determining whether text formatting needs to be stripped or processed differently.

"const hasAnsi = require('has-ansi');\nconsole.log(hasAnsi('\u001B[4mUnicorn\u001B[0m')); // true\nconsole.log(hasAnsi('Unicorn')); // false"

Other packages similar to has-ansi

Keywords

FAQs

Package last updated on 10 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc