@@ -10,15 +10,13 @@ const spacePad = padString(' ')
1010const stringifyArray = R . cMap ( JSON . stringify )
1111const stringifyRows = ( rows ) => R . EitherArray ( rows ) . fold ( ( ) => null , R . cMap ( stringifyArray ) )
1212const insertColSeparators = ( arr ) => '│' + arr . join ( '│' ) + '│'
13- const getTopSeparatorLine = ( colWidths ) => getSeparatorLine ( '═' , '╒' , '╤' , '╕' , colWidths )
14- const getThickSeparatorLine = ( colWidths ) => getSeparatorLine ( '═' , '╞' , '╪' , '╡' , colWidths )
15- const getThinSeparatorLine = ( colWidths ) => getSeparatorLine ( '─' , '├' , '┼' , '┤' , colWidths )
16- const getBottomSeparatorLine = ( colWidths ) => getSeparatorLine ( '─' , '└' , '┴' , '┘' , colWidths )
17- const getSeparatorLine = ( horChar , leftChar , crossChar , rightChar , colWidths ) => {
18- return leftChar + colWidths . map ( function ( w ) {
19- return padString ( horChar ) ( w )
20- } ) . join ( crossChar ) + rightChar
13+ const getSeparatorLine = ( horChar , leftChar , crossChar , rightChar ) => ( colWidths ) => {
14+ return R . concat ( leftChar , colWidths . map ( ( w ) => padString ( horChar ) ( w ) ) . join ( crossChar ) , rightChar )
2115}
16+ const topSeparatorLine = getSeparatorLine ( '═' , '╒' , '╤' , '╕' )
17+ const thickSeparatorLine = getSeparatorLine ( '═' , '╞' , '╪' , '╡' )
18+ const thinSeparatorLine = getSeparatorLine ( '─' , '├' , '┼' , '┤' )
19+ const bottomSeparatorLine = getSeparatorLine ( '─' , '└' , '┴' , '┘' )
2220
2321const colWidths = ( maxWidth , minWidth , input ) => {
2422 const inputEither = R . EitherArray ( input )
@@ -78,14 +76,14 @@ const main = (rows, maxColWidth = 30, minColWidth = 3) => {
7876 const heights = rowHeights ( maxColWidth , rows )
7977 const norm = rowsToLines ( maxColWidth , heights , widths , rows )
8078 const header = createLines ( R . head ( norm ) )
81- const separated = R . intersperse ( getThinSeparatorLine ( widths ) , R . tail ( norm ) )
79+ const separated = R . intersperse ( thinSeparatorLine ( widths ) , R . tail ( norm ) )
8280 const lines = createLines ( separated )
8381 return [
84- getTopSeparatorLine ( widths ) ,
82+ topSeparatorLine ( widths ) ,
8583 ...header ,
86- getThickSeparatorLine ( widths ) ,
84+ thickSeparatorLine ( widths ) ,
8785 ...lines ,
88- getBottomSeparatorLine ( widths )
86+ bottomSeparatorLine ( widths )
8987 ] . join ( '\n' )
9088}
9189
0 commit comments