File tree 4 files changed +15
-13
lines changed
4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- const ansiRegex = require ( '..' ) ;
3
2
const ansiCodes = require ( './ansi-codes' ) ;
3
+ const ansiRegex = require ( '..' ) ;
4
4
5
5
const allCodes = { } ;
6
6
const supported = [ ] ;
7
7
const unsupported = [ ] ;
8
8
9
9
function addCodesToTest ( codes ) {
10
- for ( const code of Object . keys ( codes ) ) {
11
- allCodes [ code ] = codes [ code ] ;
10
+ for ( const [ key , value ] of Object . entries ( codes ) ) {
11
+ allCodes [ key ] = value ;
12
12
}
13
13
}
14
14
15
15
function identifySupportedCodes ( ) {
16
16
let codeSupport = { } ;
17
17
18
- for ( const code of Object . keys ( allCodes ) ) {
18
+ for ( const [ code , value ] of Object . keys ( allCodes ) ) {
19
19
codeSupport = {
20
20
code,
21
21
matches : `\u001B${ code } ` . match ( ansiRegex ( ) ) ,
22
- description : allCodes [ code ] [ 0 ]
22
+ description : value [ 0 ]
23
23
} ;
24
24
25
25
if ( codeSupport . matches !== null && codeSupport . matches [ 0 ] === `\u001B${ code } ` ) {
@@ -34,15 +34,15 @@ function displaySupport() {
34
34
process . stdout . write ( '\u001B[32m' ) ;
35
35
36
36
console . log ( 'SUPPORTED' ) ;
37
- for ( const el of supported ) {
38
- console . log ( el ) ;
37
+ for ( const element of supported ) {
38
+ console . log ( element ) ;
39
39
}
40
40
41
41
process . stdout . write ( '\u001B[31m' ) ;
42
42
console . log ( 'UNSUPPORTED' ) ;
43
43
44
- for ( const el of unsupported ) {
45
- console . log ( el ) ;
44
+ for ( const element of unsupported ) {
45
+ console . log ( element ) ;
46
46
}
47
47
48
48
process . stdout . write ( '\u001B[0m' ) ;
Original file line number Diff line number Diff line change 1
1
import { expectType } from 'tsd' ;
2
- import ansiRegex from '.' ;
2
+ import ansiRegex = require ( '.' ) ;
3
3
4
4
expectType < RegExp > ( ansiRegex ( ) ) ;
5
5
expectType < RegExp > ( ansiRegex ( { onlyFirst : true } ) ) ;
Original file line number Diff line number Diff line change 48
48
" pattern"
49
49
],
50
50
"devDependencies" : {
51
- "ava" : " ^1 .4.1 " ,
51
+ "ava" : " ^2 .4.0 " ,
52
52
"tsd" : " ^0.9.0" ,
53
- "xo" : " ^0.24.0 "
53
+ "xo" : " ^0.25.3 "
54
54
}
55
55
}
Original file line number Diff line number Diff line change @@ -34,12 +34,14 @@ ansiRegex().test('cake');
34
34
35
35
## API
36
36
37
- ### ansiRegex([ options] )
37
+ ### ansiRegex(options? )
38
38
39
39
Returns a regex for matching ANSI escape codes.
40
40
41
41
#### options
42
42
43
+ Type: ` object `
44
+
43
45
##### onlyFirst
44
46
45
47
Type: ` boolean ` <br >
You can’t perform that action at this time.
0 commit comments