|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
690 bytes
|
| Line | |
|---|
| 1 | var ansiRegex = new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|"), "g");
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | *
|
|---|
| 5 | * Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
|---|
| 6 | * Adapted from code originally released by Sindre Sorhus
|
|---|
| 7 | * Licensed the MIT License
|
|---|
| 8 | *
|
|---|
| 9 | * @param {string} string
|
|---|
| 10 | * @return {string}
|
|---|
| 11 | */
|
|---|
| 12 | function stripAnsi(string) {
|
|---|
| 13 | if (typeof string !== "string") {
|
|---|
| 14 | throw new TypeError("Expected a `string`, got `".concat(typeof string, "`"));
|
|---|
| 15 | }
|
|---|
| 16 | return string.replace(ansiRegex, "");
|
|---|
| 17 | }
|
|---|
| 18 | export default stripAnsi; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.