strip-ansi 6.0.1 → 7.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/index.d.ts CHANGED
@@ -3,7 +3,7 @@ Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a
3
3
 
4
4
  @example
5
5
  ```
6
- import stripAnsi = require('strip-ansi');
6
+ import stripAnsi from 'strip-ansi';
7
7
 
8
8
  stripAnsi('\u001B[4mUnicorn\u001B[0m');
9
9
  //=> 'Unicorn'
@@ -12,6 +12,4 @@ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
12
12
  //=> 'Click'
13
13
  ```
14
14
  */
15
- declare function stripAnsi(string: string): string;
16
-
17
- export = stripAnsi;
15
+ export default function stripAnsi(string: string): string;
package/index.js CHANGED
@@ -1,4 +1,9 @@
1
- 'use strict';
2
- const ansiRegex = require('ansi-regex');
1
+ import ansiRegex from 'ansi-regex';
3
2
 
4
- module.exports = 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
+ }
7
+
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,16 +1,19 @@
1
1
  {
2
2
  "name": "strip-ansi",
3
- "version": "6.0.1",
3
+ "version": "7.0.0",
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": ">=8"
16
+ "node": ">=12"
14
17
  },
15
18
  "scripts": {
16
19
  "test": "xo && ava && tsd"
@@ -44,11 +47,11 @@
44
47
  "text"
45
48
  ],
46
49
  "dependencies": {
47
- "ansi-regex": "^5.0.1"
50
+ "ansi-regex": "^6.0.0"
48
51
  },
49
52
  "devDependencies": {
50
- "ava": "^2.4.0",
51
- "tsd": "^0.10.0",
52
- "xo": "^0.25.3"
53
+ "ava": "^3.15.0",
54
+ "tsd": "^0.14.0",
55
+ "xo": "^0.38.2"
53
56
  }
54
57
  }
package/readme.md CHANGED
@@ -1,19 +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
5
  ## Install
7
6
 
8
7
  ```
9
8
  $ npm install strip-ansi
10
9
  ```
11
10
 
12
-
13
11
  ## Usage
14
12
 
15
13
  ```js
16
- const stripAnsi = require('strip-ansi');
14
+ import stripAnsi from 'strip-ansi';
17
15
 
18
16
  stripAnsi('\u001B[4mUnicorn\u001B[0m');
19
17
  //=> 'Unicorn'
@@ -22,14 +20,12 @@ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
22
20
  //=> 'Click'
23
21
  ```
24
22
 
25
-
26
23
  ## strip-ansi for enterprise
27
24
 
28
25
  Available as part of the Tidelift Subscription.
29
26
 
30
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)
31
28
 
32
-
33
29
  ## Related
34
30
 
35
31
  - [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
@@ -38,7 +34,6 @@ The maintainers of strip-ansi and thousands of other packages are working with T
38
34
  - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
39
35
  - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
40
36
 
41
-
42
37
  ## Maintainers
43
38
 
44
39
  - [Sindre Sorhus](https://github.com/sindresorhus)