has-ansi
Advanced tools
Comparing version 2.0.0 to 3.0.0
'use strict'; | ||
var ansiRegex = require('ansi-regex'); | ||
var re = new RegExp(ansiRegex().source); // remove the `g` flag | ||
module.exports = re.test.bind(re); | ||
const ansiRegex = require('ansi-regex'); | ||
// Remove the `g` flag | ||
const re = new RegExp(ansiRegex().source); | ||
module.exports = input => re.test(input); |
{ | ||
"name": "has-ansi", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Check if a string has ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "sindresorhus/has-ansi", | ||
"repository": "chalk/has-ansi", | ||
"author": { | ||
@@ -12,11 +12,7 @@ "name": "Sindre Sorhus", | ||
}, | ||
"maintainers": [ | ||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)", | ||
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)" | ||
], | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "node test.js" | ||
"test": "xo && ava" | ||
}, | ||
@@ -51,7 +47,8 @@ "files": [ | ||
"dependencies": { | ||
"ansi-regex": "^2.0.0" | ||
"ansi-regex": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4" | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) | ||
# has-ansi [![Build Status](https://travis-ci.org/chalk/has-ansi.svg?branch=master)](https://travis-ci.org/chalk/has-ansi) | ||
> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) | ||
> Check if a string has [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) | ||
@@ -9,3 +9,3 @@ | ||
``` | ||
$ npm install --save has-ansi | ||
$ npm install has-ansi | ||
``` | ||
@@ -17,5 +17,5 @@ | ||
```js | ||
var hasAnsi = require('has-ansi'); | ||
const hasAnsi = require('has-ansi'); | ||
hasAnsi('\u001b[4mcake\u001b[0m'); | ||
hasAnsi('\u001B[4mUnicorn\u001B[0m'); | ||
//=> true | ||
@@ -30,10 +30,15 @@ | ||
- [has-ansi-cli](https://github.com/sindresorhus/has-ansi-cli) - CLI for this module | ||
- [strip-ansi](https://github.com/sindresorhus/strip-ansi) - Strip ANSI escape codes | ||
- [ansi-regex](https://github.com/sindresorhus/ansi-regex) - Regular expression for matching ANSI escape codes | ||
- [chalk](https://github.com/sindresorhus/chalk) - Terminal string styling done right | ||
- [has-ansi-cli](https://github.com/chalk/has-ansi-cli) - CLI for this module | ||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes | ||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes | ||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right | ||
## Maintainers | ||
- [Sindre Sorhus](https://github.com/sindresorhus) | ||
- [Josh Junon](https://github.com/qix-) | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
5
42
2969
2
+ Addedansi-regex@3.0.1(transitive)
- Removedansi-regex@2.1.1(transitive)
Updatedansi-regex@^3.0.0