1 |
3a515b92
|
cagy
|
# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi)
|
2 |
|
|
|
3 |
|
|
> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
## Install
|
7 |
|
|
|
8 |
|
|
```
|
9 |
|
|
$ npm install --save has-ansi
|
10 |
|
|
```
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
## Usage
|
14 |
|
|
|
15 |
|
|
```js
|
16 |
|
|
var hasAnsi = require('has-ansi');
|
17 |
|
|
|
18 |
|
|
hasAnsi('\u001b[4mcake\u001b[0m');
|
19 |
|
|
//=> true
|
20 |
|
|
|
21 |
|
|
hasAnsi('cake');
|
22 |
|
|
//=> false
|
23 |
|
|
```
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
## Related
|
27 |
|
|
|
28 |
|
|
- [has-ansi-cli](https://github.com/sindresorhus/has-ansi-cli) - CLI for this module
|
29 |
|
|
- [strip-ansi](https://github.com/sindresorhus/strip-ansi) - Strip ANSI escape codes
|
30 |
|
|
- [ansi-regex](https://github.com/sindresorhus/ansi-regex) - Regular expression for matching ANSI escape codes
|
31 |
|
|
- [chalk](https://github.com/sindresorhus/chalk) - Terminal string styling done right
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
## License
|
35 |
|
|
|
36 |
|
|
MIT © [Sindre Sorhus](http://sindresorhus.com)
|