Gathering detailed insights and metrics for cli-table
Gathering detailed insights and metrics for cli-table
Gathering detailed insights and metrics for cli-table
Gathering detailed insights and metrics for cli-table
npm install cli-table
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (99.33%)
Makefile (0.67%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2,291 Stars
130 Commits
143 Forks
121 Watchers
2 Branches
158 Contributors
Updated on Jul 10, 2025
Latest Version
0.3.11
Package Id
cli-table@0.3.11
Unpacked Size
16.89 kB
Size
5.94 kB
File Count
5
NPM Version
7.24.0
Node Version
14.17.3
Published on
Dec 06, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This utility allows you to render unicode-aided tables on the command line from your node.js scripts.
1npm install cli-table
1var Table = require('cli-table'); 2 3// instantiate 4var table = new Table({ 5 head: ['TH 1 label', 'TH 2 label'] 6 , colWidths: [100, 200] 7}); 8 9// table is an Array, so you can `push`, `unshift`, `splice` and friends 10table.push( 11 ['First value', 'Second value'] 12 , ['First value', 'Second value'] 13); 14 15console.log(table.toString());
Optionally you can initialize rows in the constructors directly - comes in handy for smaller tables:
new Table({
rows: [
['foo', '7 minutes ago']
, ['bar', '8 minutes ago']
]
})
1var Table = require('cli-table'); 2var table = new Table(); 3 4table.push( 5 { 'Some key': 'Some value' } 6 , { 'Another key': 'Another value' } 7); 8 9console.log(table.toString());
Cross tables are very similar to vertical tables, with two key differences:
head
setting when instantiated that has an empty string as the first header1var Table = require('cli-table'); 2var table = new Table({ head: ["", "Top Header 1", "Top Header 2"] }); 3 4table.push( 5 { 'Left Header 1': ['Value Row 1 Col 1', 'Value Row 1 Col 2'] } 6 , { 'Left Header 2': ['Value Row 2 Col 1', 'Value Row 2 Col 2'] } 7); 8 9console.log(table.toString());
The chars
property controls how the table is drawn:
1var table = new Table({ 2 chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗' 3 , 'bottom': '═' , 'bottom-mid': '╧' , 'bottom-left': '╚' , 'bottom-right': '╝' 4 , 'left': '║' , 'left-mid': '╟' , 'mid': '─' , 'mid-mid': '┼' 5 , 'right': '║' , 'right-mid': '╢' , 'middle': '│' } 6}); 7 8table.push( 9 ['foo', 'bar', 'baz'] 10 , ['frob', 'bar', 'quuz'] 11); 12 13console.log(table.toString()); 14// Outputs: 15// 16//╔══════╤═════╤══════╗ 17//║ foo │ bar │ baz ║ 18//╟──────┼─────┼──────╢ 19//║ frob │ bar │ quuz ║ 20//╚══════╧═════╧══════╝
Empty decoration lines will be skipped, to avoid vertical separator rows just set the 'mid', 'left-mid', 'mid-mid', 'right-mid' to the empty string:
1var table = new Table({ chars: {'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': ''} }); 2table.push( 3 ['foo', 'bar', 'baz'] 4 , ['frobnicate', 'bar', 'quuz'] 5); 6 7console.log(table.toString()); 8// Outputs: (note the lack of the horizontal line between rows) 9//┌────────────┬─────┬──────┐ 10//│ foo │ bar │ baz │ 11//│ frobnicate │ bar │ quuz │ 12//└────────────┴─────┴──────┘
By setting all chars to empty with the exception of 'middle' being set to a single space and by setting padding to zero, it's possible to get the most compact layout with no decorations:
1var table = new Table({ 2 chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': '' 3 , 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': '' 4 , 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': '' 5 , 'right': '' , 'right-mid': '' , 'middle': ' ' }, 6 style: { 'padding-left': 0, 'padding-right': 0 } 7}); 8 9table.push( 10 ['foo', 'bar', 'baz'] 11 , ['frobnicate', 'bar', 'quuz'] 12); 13 14console.log(table.toString()); 15// Outputs: 16//foo bar baz 17//frobnicate bar quuz
Clone the repository with all its submodules and run:
1$ make test
(The MIT License)
Copyright (c) 2010 LearnBoost <dev@learnboost.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 6/22 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More