-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc62ac2
commit 5922c60
Showing
7 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
* text=auto | ||
*.js text eol=lf | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- '12' | ||
- '10' | ||
- '8' | ||
- '6' | ||
- '4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use strict'; | ||
const ansiRegex = require('ansi-regex'); | ||
|
||
// Remove the `g` flag | ||
const re = new RegExp(ansiRegex().source); | ||
// Removes the `g` flag | ||
const regex = new RegExp(ansiRegex().source); | ||
|
||
module.exports = input => re.test(input); | ||
module.exports = string => regex.test(string); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,51 @@ | ||
{ | ||
"name": "has-ansi", | ||
"version": "3.0.0", | ||
"description": "Check if a string has ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "chalk/has-ansi", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "[email protected]", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"ansi", | ||
"styles", | ||
"color", | ||
"colour", | ||
"colors", | ||
"terminal", | ||
"console", | ||
"string", | ||
"tty", | ||
"escape", | ||
"shell", | ||
"xterm", | ||
"command-line", | ||
"text", | ||
"regex", | ||
"regexp", | ||
"re", | ||
"match", | ||
"test", | ||
"find", | ||
"pattern", | ||
"has" | ||
], | ||
"dependencies": { | ||
"ansi-regex": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "has-ansi", | ||
"version": "3.0.0", | ||
"description": "Check if a string has ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "chalk/has-ansi", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "[email protected]", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"ansi", | ||
"styles", | ||
"color", | ||
"colour", | ||
"colors", | ||
"terminal", | ||
"console", | ||
"string", | ||
"tty", | ||
"escape", | ||
"shell", | ||
"xterm", | ||
"command-line", | ||
"text", | ||
"regex", | ||
"regexp", | ||
"match", | ||
"test", | ||
"find", | ||
"pattern", | ||
"has" | ||
], | ||
"dependencies": { | ||
"ansi-regex": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.3.0", | ||
"xo": "^0.24.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import test from 'ava'; | ||
import m from '.'; | ||
import hasAnsi from '.'; | ||
|
||
test(t => { | ||
t.true(m('foo\u001B[4mcake\u001B[0m')); | ||
t.false(m('cake')); | ||
test('main', t => { | ||
t.true(hasAnsi('foo\u001B[4mcake\u001B[0m')); | ||
t.false(hasAnsi('cake')); | ||
}); |