@@ -75,9 +75,7 @@ export class TableRenderer {
7575 const label = labels [ i ] ;
7676 const values = processedData . map ( ( row ) => {
7777 const value = row [ key ] ;
78- const formatted = formatters [ key ]
79- ? formatters [ key ] ( value )
80- : String ( value ?? "" ) ;
78+ const formatted = formatters [ key ] ? formatters [ key ] ( value ) : String ( value ?? "" ) ;
8179 return ColorSystem . visibleLength ( formatted ) ;
8280 } ) ;
8381 return Math . min (
@@ -118,9 +116,7 @@ export class TableRenderer {
118116 const line = widths . map ( ( w ) => "─" . repeat ( w ) ) . join ( "─┼─" ) ;
119117 const separator = `├─${ line } ─┤` ;
120118 console . log (
121- colorize
122- ? ColorSystem . colorize ( separator , ColorSystem . codes . dim )
123- : separator ,
119+ colorize ? ColorSystem . colorize ( separator , ColorSystem . codes . dim ) : separator ,
124120 ) ;
125121 }
126122
@@ -129,15 +125,11 @@ export class TableRenderer {
129125 widths : number [ ] ,
130126 colorize : boolean ,
131127 ) : void {
132- const cells = labels . map ( ( label , i ) =>
133- Formatter . tableCell ( label , widths [ i ] , "center" )
134- ) ;
128+ const cells = labels . map ( ( label , i ) => Formatter . tableCell ( label , widths [ i ] , "center" ) ) ;
135129 const row = cells . join ( " │ " ) ;
136130 const fullRow = `│ ${ row } │` ;
137131 console . log (
138- colorize
139- ? ColorSystem . colorize ( fullRow , ColorSystem . codes . bright )
140- : fullRow ,
132+ colorize ? ColorSystem . colorize ( fullRow , ColorSystem . codes . bright ) : fullRow ,
141133 ) ;
142134 }
143135
@@ -151,9 +143,7 @@ export class TableRenderer {
151143 ) : void {
152144 const cells = keys . map ( ( key , i ) => {
153145 const value = row [ key ] ;
154- const formatted = formatters [ key ]
155- ? formatters [ key ] ( value )
156- : String ( value ?? "" ) ;
146+ const formatted = formatters [ key ] ? formatters [ key ] ( value ) : String ( value ?? "" ) ;
157147 return Formatter . tableCell ( formatted , widths [ i ] ) ;
158148 } ) ;
159149
@@ -185,12 +175,8 @@ export class TableRenderer {
185175 const label = Formatter . pad ( item . label , labelWidth ) ;
186176 const value = Formatter . pad ( String ( item . value ) , valueWidth ) ;
187177
188- const labelColored = colorize
189- ? ColorSystem . colorize ( label , ColorSystem . codes . cyan )
190- : label ;
191- const valueColored = colorize
192- ? ColorSystem . colorize ( value , ColorSystem . codes . bright )
193- : value ;
178+ const labelColored = colorize ? ColorSystem . colorize ( label , ColorSystem . codes . cyan ) : label ;
179+ const valueColored = colorize ? ColorSystem . colorize ( value , ColorSystem . codes . bright ) : value ;
194180
195181 console . log ( `│ ${ labelColored } │ ${ valueColored } │` ) ;
196182 } ) ;
0 commit comments