isansi
TypeScript icon, indicating that this package has built-in type declarations

2.0.14 • Public • Published

isansi

isansi checks whether a string uses ANSI color and style.

Status

Category Status
Version npm
Dependencies David
Dev dependencies David
Build GitHub Actions
License GitHub

Installation

$ npm install isansi

Quick start

First you need to add a reference to isansi in your application:

const { isAnsi } = require('isansi');

If you use TypeScript, use the following code instead:

import { isAnsi } from 'isAnsi';

To check a string for a specific color or style, use the appropriate function of the isAnsi object:

const text = chalk.green.bold('foo');

console.log(isAnsi.green(text));  // => true
console.log(isAnsi.bold(text));   // => true

console.log(isAnsi.red(text));    // => false
console.log(isAnsi.italic(text)); // => false

The module supports all colors and styles that are supported by chalk.

Running quality assurance

To run quality assurance for this module use roboter:

$ npx roboter

Readme

Keywords

Package Sidebar

Install

npm i isansi

Weekly Downloads

6

Version

2.0.14

License

MIT

Unpacked Size

15.9 kB

Total Files

12

Last publish

Collaborators

  • thenativeweb-admin
  • goloroden