-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve table width calculation
- Loading branch information
1 parent
fb9fa21
commit 4a71378
Showing
2 changed files
with
41 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {printTable} from '../src/index.js' | ||
|
||
const height = 10 | ||
const data = Array.from({length: height}, (_, i) => ({age: i, name: `Foo ${i}`})) | ||
|
||
printTable({ | ||
columns: [ | ||
{key: 'name', name: 'Name'.repeat(100)}, | ||
{key: 'age', name: 'Age'.repeat(100)}, | ||
], | ||
data, | ||
headerOptions: { | ||
formatter: 'capitalCase', | ||
}, | ||
horizontalAlignment: 'center', | ||
title: 'Long Column Names', | ||
titleOptions: {bold: true}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters