[Pkg-javascript-commits] [node-has-ansi] 01/01: Imported Upstream version 2.0.0
Mathias Behrle
mbehrle at moszumanska.debian.org
Sat Jul 23 13:42:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
mbehrle pushed a commit to branch upstream
in repository node-has-ansi.
commit b6efa22344821cd77048d6417904f7b2b7365945
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Jul 15 18:52:30 2016 +0200
Imported Upstream version 2.0.0
---
.editorconfig | 2 +-
.jshintrc | 1 -
cli.js | 45 ---------------------------------------------
package.json | 23 ++++++++---------------
readme.md | 21 ++++++---------------
test.js | 29 +++++------------------------
6 files changed, 20 insertions(+), 101 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 86c8f59..8f9d77e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,7 +7,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-[package.json]
+[{package.json,*.yml}]
indent_style = space
indent_size = 2
diff --git a/.jshintrc b/.jshintrc
index 804f8af..9fe1be2 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -2,7 +2,6 @@
"node": true,
"esnext": true,
"bitwise": true,
- "camelcase": true,
"curly": true,
"immed": true,
"newcap": true,
diff --git a/cli.js b/cli.js
deleted file mode 100755
index 0386a82..0000000
--- a/cli.js
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env node
-'use strict';
-var stdin = require('get-stdin');
-var pkg = require('./package.json');
-var hasAnsi = require('./');
-var argv = process.argv.slice(2);
-var input = argv[0];
-
-function help() {
- console.log([
- '',
- ' ' + pkg.description,
- '',
- ' Usage',
- ' has-ansi <string>',
- ' echo <string> | has-ansi',
- '',
- ' Exits with code 0 if input has ANSI escape codes and 1 if not'
- ].join('\n'));
-}
-
-function init(data) {
- process.exit(hasAnsi(data) ? 0 : 1);
-}
-
-if (argv.indexOf('--help') !== -1) {
- help();
- return;
-}
-
-if (argv.indexOf('--version') !== -1) {
- console.log(pkg.version);
- return;
-}
-
-if (process.stdin.isTTY) {
- if (!input) {
- help();
- return;
- }
-
- init(input);
-} else {
- stdin(init);
-}
diff --git a/package.json b/package.json
index 5bc942d..01e08d4 100644
--- a/package.json
+++ b/package.json
@@ -1,34 +1,28 @@
{
"name": "has-ansi",
- "version": "1.0.3",
+ "version": "2.0.0",
"description": "Check if a string has ANSI escape codes",
"license": "MIT",
"repository": "sindresorhus/has-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus at gmail.com",
- "url": "http://sindresorhus.com"
+ "url": "sindresorhus.com"
},
"maintainers": [
- "Sindre Sorhus <sindresorhus at gmail.com> (http://sindresorhus.com)",
- "Joshua Appelman <jappelman at xebia.com> (http://jbnicolai.com)"
+ "Sindre Sorhus <sindresorhus at gmail.com> (sindresorhus.com)",
+ "Joshua Appelman <jappelman at xebia.com> (jbnicolai.com)"
],
- "bin": {
- "has-ansi": "cli.js"
- },
"engines": {
"node": ">=0.10.0"
},
"scripts": {
- "test": "mocha"
+ "test": "node test.js"
},
"files": [
- "index.js",
- "cli.js"
+ "index.js"
],
"keywords": [
- "cli",
- "bin",
"ansi",
"styles",
"color",
@@ -53,10 +47,9 @@
"has"
],
"dependencies": {
- "ansi-regex": "^1.1.0",
- "get-stdin": "^4.0.1"
+ "ansi-regex": "^2.0.0"
},
"devDependencies": {
- "mocha": "*"
+ "ava": "0.0.4"
}
}
diff --git a/readme.md b/readme.md
index 0fa149a..02bc7c2 100644
--- a/readme.md
+++ b/readme.md
@@ -5,7 +5,7 @@
## Install
-```sh
+```
$ npm install --save has-ansi
```
@@ -23,21 +23,12 @@ hasAnsi('cake');
```
-## CLI
-
-```sh
-$ npm install --global has-ansi
-```
+## Related
-```
-$ has-ansi --help
-
- Usage
- has-ansi <string>
- echo <string> | has-ansi
-
- Exits with code 0 if input has ANSI escape codes and 1 if not
-```
+- [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
## License
diff --git a/test.js b/test.js
index f9e2f47..1374c50 100644
--- a/test.js
+++ b/test.js
@@ -1,28 +1,9 @@
'use strict';
-var assert = require('assert');
-var childProcess = require('child_process');
+var test = require('ava');
var hasAnsi = require('./');
-it('should check if a string has ANSI escape codes', function () {
- assert(hasAnsi('foo\u001b[4mcake\u001b[0m'));
- assert(!hasAnsi('cake'));
-});
-
-describe('the cli', function () {
-
- it('should exit with 0 if called with stdin containing ANSI escape codes', function (done) {
- var cli = childProcess.exec('echo -e "foo\u001b[4mcake\u001b[0m" | ./cli.js');
- cli.on('exit', function (code) {
- assert(code === 0);
- done()
- });
- });
-
- it('should exit with 1 if called with stdin containing ANSI escape codes', function (done) {
- var cli = childProcess.exec('echo -e "boring plain old string" | ./cli.js');
- cli.on('exit', function (code) {
- assert(code === 1);
- done()
- });
- });
+test(function (t) {
+ t.assert(hasAnsi('foo\u001b[4mcake\u001b[0m'));
+ t.assert(!hasAnsi('cake'));
+ t.end();
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-has-ansi.git
More information about the Pkg-javascript-commits
mailing list