File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- const ansiRegex = require ( '..' ) ;
32const ansiCodes = require ( './ansi-codes' ) ;
3+ const ansiRegex = require ( '..' ) ;
44
55const allCodes = { } ;
66const supported = [ ] ;
77const unsupported = [ ] ;
88
99function 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 ;
1212 }
1313}
1414
1515function identifySupportedCodes ( ) {
1616 let codeSupport = { } ;
1717
18- for ( const code of Object . keys ( allCodes ) ) {
18+ for ( const [ code , value ] of Object . keys ( allCodes ) ) {
1919 codeSupport = {
2020 code,
2121 matches : `\u001B${ code } ` . match ( ansiRegex ( ) ) ,
22- description : allCodes [ code ] [ 0 ]
22+ description : value [ 0 ]
2323 } ;
2424
2525 if ( codeSupport . matches !== null && codeSupport . matches [ 0 ] === `\u001B${ code } ` ) {
@@ -34,15 +34,15 @@ function displaySupport() {
3434 process . stdout . write ( '\u001B[32m' ) ;
3535
3636 console . log ( 'SUPPORTED' ) ;
37- for ( const el of supported ) {
38- console . log ( el ) ;
37+ for ( const element of supported ) {
38+ console . log ( element ) ;
3939 }
4040
4141 process . stdout . write ( '\u001B[31m' ) ;
4242 console . log ( 'UNSUPPORTED' ) ;
4343
44- for ( const el of unsupported ) {
45- console . log ( el ) ;
44+ for ( const element of unsupported ) {
45+ console . log ( element ) ;
4646 }
4747
4848 process . stdout . write ( '\u001B[0m' ) ;
Original file line number Diff line number Diff line change 11import { expectType } from 'tsd' ;
2- import ansiRegex from '.' ;
2+ import ansiRegex = require ( '.' ) ;
33
44expectType < RegExp > ( ansiRegex ( ) ) ;
55expectType < RegExp > ( ansiRegex ( { onlyFirst : true } ) ) ;
Original file line number Diff line number Diff line change 4848 " pattern"
4949 ],
5050 "devDependencies" : {
51- "ava" : " ^1 .4.1 " ,
51+ "ava" : " ^2 .4.0 " ,
5252 "tsd" : " ^0.9.0" ,
53- "xo" : " ^0.24.0 "
53+ "xo" : " ^0.25.3 "
5454 }
5555}
Original file line number Diff line number Diff line change @@ -34,12 +34,14 @@ ansiRegex().test('cake');
3434
3535## API
3636
37- ### ansiRegex([ options] )
37+ ### ansiRegex(options? )
3838
3939Returns a regex for matching ANSI escape codes.
4040
4141#### options
4242
43+ Type: ` object `
44+
4345##### onlyFirst
4446
4547Type: ` boolean ` <br >
You can’t perform that action at this time.
0 commit comments