strip-ansi 2.0.1 → 5.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.
Files changed (5) hide show
  1. package/index.js +2 -4
  2. package/license +9 -0
  3. package/package.json +50 -54
  4. package/readme.md +30 -20
  5. package/cli.js +0 -47
package/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  'use strict';
2
- var ansiRegex = require('ansi-regex')();
2
+ const ansiRegex = require('ansi-regex');
3
3
 
4
- module.exports = function (str) {
5
- return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
6
- };
4
+ module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input;
package/license ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,56 +1,52 @@
1
1
  {
2
- "name": "strip-ansi",
3
- "version": "2.0.1",
4
- "description": "Strip ANSI escape codes",
5
- "license": "MIT",
6
- "repository": "sindresorhus/strip-ansi",
7
- "author": {
8
- "name": "Sindre Sorhus",
9
- "email": "sindresorhus@gmail.com",
10
- "url": "http://sindresorhus.com"
11
- },
12
- "bin": {
13
- "strip-ansi": "cli.js"
14
- },
15
- "engines": {
16
- "node": ">=0.10.0"
17
- },
18
- "scripts": {
19
- "test": "mocha"
20
- },
21
- "files": [
22
- "index.js",
23
- "cli.js"
24
- ],
25
- "keywords": [
26
- "strip",
27
- "trim",
28
- "remove",
29
- "ansi",
30
- "styles",
31
- "color",
32
- "colour",
33
- "colors",
34
- "terminal",
35
- "console",
36
- "cli",
37
- "string",
38
- "tty",
39
- "escape",
40
- "formatting",
41
- "rgb",
42
- "256",
43
- "shell",
44
- "xterm",
45
- "log",
46
- "logging",
47
- "command-line",
48
- "text"
49
- ],
50
- "dependencies": {
51
- "ansi-regex": "^1.0.0"
52
- },
53
- "devDependencies": {
54
- "mocha": "*"
55
- }
2
+ "name": "strip-ansi",
3
+ "version": "5.0.0",
4
+ "description": "Strip ANSI escape codes",
5
+ "license": "MIT",
6
+ "repository": "chalk/strip-ansi",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=6"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava"
17
+ },
18
+ "files": [
19
+ "index.js"
20
+ ],
21
+ "keywords": [
22
+ "strip",
23
+ "trim",
24
+ "remove",
25
+ "ansi",
26
+ "styles",
27
+ "color",
28
+ "colour",
29
+ "colors",
30
+ "terminal",
31
+ "console",
32
+ "string",
33
+ "tty",
34
+ "escape",
35
+ "formatting",
36
+ "rgb",
37
+ "256",
38
+ "shell",
39
+ "xterm",
40
+ "log",
41
+ "logging",
42
+ "command-line",
43
+ "text"
44
+ ],
45
+ "dependencies": {
46
+ "ansi-regex": "^4.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "ava": "^0.25.0",
50
+ "xo": "^0.23.0"
51
+ }
56
52
  }
package/readme.md CHANGED
@@ -1,43 +1,53 @@
1
- # strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi)
1
+ # strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)
2
2
 
3
- > Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
3
+ > Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4
4
 
5
+ ---
6
+
7
+ <div align="center">
8
+ <b>
9
+ <a href="https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for 'strip-ansi' with a Tidelift subscription</a>
10
+ </b>
11
+ <br>
12
+ <sub>
13
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
14
+ </sub>
15
+ </div>
16
+
17
+ ---
5
18
 
6
19
  ## Install
7
20
 
8
- ```sh
9
- $ npm install --save strip-ansi
21
+ ```
22
+ $ npm install strip-ansi
10
23
  ```
11
24
 
12
25
 
13
26
  ## Usage
14
27
 
15
28
  ```js
16
- var stripAnsi = require('strip-ansi');
29
+ const stripAnsi = require('strip-ansi');
17
30
 
18
- stripAnsi('\u001b[4mcake\u001b[0m');
19
- //=> 'cake'
31
+ stripAnsi('\u001B[4mUnicorn\u001B[0m');
32
+ //=> 'Unicorn'
20
33
  ```
21
34
 
22
35
 
23
- ## CLI
36
+ ## Related
24
37
 
25
- ```sh
26
- $ npm install --global strip-ansi
27
- ```
38
+ - [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
39
+ - [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module
40
+ - [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
41
+ - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
42
+ - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
28
43
 
29
- ```sh
30
- $ strip-ansi --help
31
44
 
32
- Usage
33
- strip-ansi <input-file> > <output-file>
34
- cat <input-file> | strip-ansi > <output-file>
45
+ ## Maintainers
35
46
 
36
- Example
37
- strip-ansi unicorn.txt > unicorn-stripped.txt
38
- ```
47
+ - [Sindre Sorhus](https://github.com/sindresorhus)
48
+ - [Josh Junon](https://github.com/qix-)
39
49
 
40
50
 
41
51
  ## License
42
52
 
43
- MIT © [Sindre Sorhus](http://sindresorhus.com)
53
+ MIT
package/cli.js DELETED
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- var fs = require('fs');
4
- var pkg = require('./package.json');
5
- var stripAnsi = 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
- ' strip-ansi <input-file> > <output-file>',
16
- ' cat <input-file> | strip-ansi > <output-file>',
17
- '',
18
- ' Example',
19
- ' strip-ansi unicorn.txt > unicorn-stripped.txt'
20
- ].join('\n'));
21
- }
22
-
23
- function init(data) {
24
- process.stdout.write(stripAnsi(data));
25
- }
26
-
27
- if (argv.indexOf('--help') !== -1) {
28
- help();
29
- return;
30
- }
31
-
32
- if (argv.indexOf('--version') !== -1) {
33
- console.log(pkg.version);
34
- return;
35
- }
36
-
37
- if (!input && process.stdin.isTTY) {
38
- help();
39
- return;
40
- }
41
-
42
- if (input) {
43
- init(fs.readFileSync(input, 'utf8'));
44
- } else {
45
- process.stdin.setEncoding('utf8');
46
- process.stdin.on('data', init);
47
- }