isansi
isansi checks whether a string uses ANSI color and style.
Status
Category | Status |
---|---|
Version | |
Dependencies | |
Dev dependencies | |
Build | |
License |
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