has-ansi 1.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -15
- package/readme.md +6 -15
- package/cli.js +0 -45
package/package.json
CHANGED
@@ -1,34 +1,28 @@
|
|
1
1
|
{
|
2
2
|
"name": "has-ansi",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0",
|
4
4
|
"description": "Check if a string has ANSI escape codes",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": "sindresorhus/has-ansi",
|
7
7
|
"author": {
|
8
8
|
"name": "Sindre Sorhus",
|
9
9
|
"email": "sindresorhus@gmail.com",
|
10
|
-
"url": "
|
10
|
+
"url": "sindresorhus.com"
|
11
11
|
},
|
12
12
|
"maintainers": [
|
13
|
-
"Sindre Sorhus <sindresorhus@gmail.com> (
|
14
|
-
"Joshua Appelman <jappelman@xebia.com> (
|
13
|
+
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
|
14
|
+
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)"
|
15
15
|
],
|
16
|
-
"bin": {
|
17
|
-
"has-ansi": "cli.js"
|
18
|
-
},
|
19
16
|
"engines": {
|
20
17
|
"node": ">=0.10.0"
|
21
18
|
},
|
22
19
|
"scripts": {
|
23
|
-
"test": "
|
20
|
+
"test": "node test.js"
|
24
21
|
},
|
25
22
|
"files": [
|
26
|
-
"index.js"
|
27
|
-
"cli.js"
|
23
|
+
"index.js"
|
28
24
|
],
|
29
25
|
"keywords": [
|
30
|
-
"cli",
|
31
|
-
"bin",
|
32
26
|
"ansi",
|
33
27
|
"styles",
|
34
28
|
"color",
|
@@ -53,10 +47,9 @@
|
|
53
47
|
"has"
|
54
48
|
],
|
55
49
|
"dependencies": {
|
56
|
-
"ansi-regex": "^
|
57
|
-
"get-stdin": "^4.0.1"
|
50
|
+
"ansi-regex": "^2.0.0"
|
58
51
|
},
|
59
52
|
"devDependencies": {
|
60
|
-
"
|
53
|
+
"ava": "0.0.4"
|
61
54
|
}
|
62
55
|
}
|
package/readme.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
## Install
|
7
7
|
|
8
|
-
```
|
8
|
+
```
|
9
9
|
$ npm install --save has-ansi
|
10
10
|
```
|
11
11
|
|
@@ -23,21 +23,12 @@ hasAnsi('cake');
|
|
23
23
|
```
|
24
24
|
|
25
25
|
|
26
|
-
##
|
27
|
-
|
28
|
-
```sh
|
29
|
-
$ npm install --global has-ansi
|
30
|
-
```
|
26
|
+
## Related
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
has-ansi <string>
|
37
|
-
echo <string> | has-ansi
|
38
|
-
|
39
|
-
Exits with code 0 if input has ANSI escape codes and 1 if not
|
40
|
-
```
|
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
|
41
32
|
|
42
33
|
|
43
34
|
## License
|
package/cli.js
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
'use strict';
|
3
|
-
var stdin = require('get-stdin');
|
4
|
-
var pkg = require('./package.json');
|
5
|
-
var hasAnsi = require('./');
|
6
|
-
var argv = process.argv.slice(2);
|
7
|
-
var input = argv[0];
|
8
|
-
|
9
|
-
function help() {
|
10
|
-
console.log([
|
11
|
-
'',
|
12
|
-
' ' + pkg.description,
|
13
|
-
'',
|
14
|
-
' Usage',
|
15
|
-
' has-ansi <string>',
|
16
|
-
' echo <string> | has-ansi',
|
17
|
-
'',
|
18
|
-
' Exits with code 0 if input has ANSI escape codes and 1 if not'
|
19
|
-
].join('\n'));
|
20
|
-
}
|
21
|
-
|
22
|
-
function init(data) {
|
23
|
-
process.exit(hasAnsi(data) ? 0 : 1);
|
24
|
-
}
|
25
|
-
|
26
|
-
if (argv.indexOf('--help') !== -1) {
|
27
|
-
help();
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
|
31
|
-
if (argv.indexOf('--version') !== -1) {
|
32
|
-
console.log(pkg.version);
|
33
|
-
return;
|
34
|
-
}
|
35
|
-
|
36
|
-
if (process.stdin.isTTY) {
|
37
|
-
if (!input) {
|
38
|
-
help();
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
|
42
|
-
init(input);
|
43
|
-
} else {
|
44
|
-
stdin(init);
|
45
|
-
}
|