strip-ansi 5.2.0 → 7.0.1

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 (4) hide show
  1. package/index.js +7 -5
  2. package/license +1 -1
  3. package/package.json +11 -8
  4. package/readme.md +5 -25
package/index.js CHANGED
@@ -1,7 +1,9 @@
1
- 'use strict';
2
- const ansiRegex = require('ansi-regex');
1
+ import ansiRegex from 'ansi-regex';
3
2
 
4
- const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
3
+ export default function stripAnsi(string) {
4
+ if (typeof string !== 'string') {
5
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
6
+ }
5
7
 
6
- module.exports = stripAnsi;
7
- module.exports.default = stripAnsi;
8
+ return string.replace(ansiRegex(), '');
9
+ }
package/license CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
4
 
5
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
6
 
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "strip-ansi",
3
- "version": "5.2.0",
3
+ "version": "7.0.1",
4
4
  "description": "Strip ANSI escape codes from a string",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/strip-ansi",
7
+ "funding": "https://github.com/chalk/strip-ansi?sponsor=1",
7
8
  "author": {
8
9
  "name": "Sindre Sorhus",
9
10
  "email": "sindresorhus@gmail.com",
10
- "url": "sindresorhus.com"
11
+ "url": "https://sindresorhus.com"
11
12
  },
13
+ "type": "module",
14
+ "exports": "./index.js",
12
15
  "engines": {
13
- "node": ">=6"
16
+ "node": ">=12"
14
17
  },
15
18
  "scripts": {
16
- "test": "xo && ava && tsd-check"
19
+ "test": "xo && ava && tsd"
17
20
  },
18
21
  "files": [
19
22
  "index.js",
@@ -44,11 +47,11 @@
44
47
  "text"
45
48
  ],
46
49
  "dependencies": {
47
- "ansi-regex": "^4.1.0"
50
+ "ansi-regex": "^6.0.1"
48
51
  },
49
52
  "devDependencies": {
50
- "ava": "^1.3.1",
51
- "tsd-check": "^0.5.0",
52
- "xo": "^0.24.0"
53
+ "ava": "^3.15.0",
54
+ "tsd": "^0.17.0",
55
+ "xo": "^0.44.0"
53
56
  }
54
57
  }
package/readme.md CHANGED
@@ -1,32 +1,17 @@
1
- # strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)
1
+ # strip-ansi
2
2
 
3
3
  > Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
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
- ---
18
-
19
5
  ## Install
20
6
 
21
7
  ```
22
8
  $ npm install strip-ansi
23
9
  ```
24
10
 
25
-
26
11
  ## Usage
27
12
 
28
13
  ```js
29
- const stripAnsi = require('strip-ansi');
14
+ import stripAnsi from 'strip-ansi';
30
15
 
31
16
  stripAnsi('\u001B[4mUnicorn\u001B[0m');
32
17
  //=> 'Unicorn'
@@ -35,11 +20,11 @@ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
35
20
  //=> 'Click'
36
21
  ```
37
22
 
23
+ ## strip-ansi for enterprise
38
24
 
39
- ## Security
40
-
41
- To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
25
+ Available as part of the Tidelift Subscription.
42
26
 
27
+ The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
43
28
 
44
29
  ## Related
45
30
 
@@ -49,13 +34,8 @@ To report a security vulnerability, please use the [Tidelift security contact](h
49
34
  - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
50
35
  - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
51
36
 
52
-
53
37
  ## Maintainers
54
38
 
55
39
  - [Sindre Sorhus](https://github.com/sindresorhus)
56
40
  - [Josh Junon](https://github.com/qix-)
57
41
 
58
-
59
- ## License
60
-
61
- MIT