Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
744 bytes
|
Line | |
---|
1 | declare namespace ansiRegex {
|
---|
2 | interface Options {
|
---|
3 | /**
|
---|
4 | Match only the first ANSI escape.
|
---|
5 |
|
---|
6 | @default false
|
---|
7 | */
|
---|
8 | onlyFirst: boolean;
|
---|
9 | }
|
---|
10 | }
|
---|
11 |
|
---|
12 | /**
|
---|
13 | Regular expression for matching ANSI escape codes.
|
---|
14 |
|
---|
15 | @example
|
---|
16 | ```
|
---|
17 | import ansiRegex = require('ansi-regex');
|
---|
18 |
|
---|
19 | ansiRegex().test('\u001B[4mcake\u001B[0m');
|
---|
20 | //=> true
|
---|
21 |
|
---|
22 | ansiRegex().test('cake');
|
---|
23 | //=> false
|
---|
24 |
|
---|
25 | '\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
---|
26 | //=> ['\u001B[4m', '\u001B[0m']
|
---|
27 |
|
---|
28 | '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
---|
29 | //=> ['\u001B[4m']
|
---|
30 |
|
---|
31 | '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
---|
32 | //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
---|
33 | ```
|
---|
34 | */
|
---|
35 | declare function ansiRegex(options?: ansiRegex.Options): RegExp;
|
---|
36 |
|
---|
37 | export = ansiRegex;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.