Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socketโs threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
org.webjars.npm:cli-table
Advanced tools
This utility allows you to render unicode-aided tables on the command line from your node.js scripts.
npm install cli-table
var Table = require('cli-table');
// instantiate
var table = new Table({
head: ['TH 1 label', 'TH 2 label']
, colWidths: [100, 200]
});
// table is an Array, so you can `push`, `unshift`, `splice` and friends
table.push(
['First value', 'Second value']
, ['First value', 'Second value']
);
console.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']
]
})
var Table = require('cli-table');
var table = new Table();
table.push(
{ 'Some key': 'Some value' }
, { 'Another key': 'Another value' }
);
console.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 headervar Table = require('cli-table');
var table = new Table({ head: ["", "Top Header 1", "Top Header 2"] });
table.push(
{ 'Left Header 1': ['Value Row 1 Col 1', 'Value Row 1 Col 2'] }
, { 'Left Header 2': ['Value Row 2 Col 1', 'Value Row 2 Col 2'] }
);
console.log(table.toString());
The chars
property controls how the table is drawn:
var table = new Table({
chars: { 'top': 'โ' , 'top-mid': 'โค' , 'top-left': 'โ' , 'top-right': 'โ'
, 'bottom': 'โ' , 'bottom-mid': 'โง' , 'bottom-left': 'โ' , 'bottom-right': 'โ'
, 'left': 'โ' , 'left-mid': 'โ' , 'mid': 'โ' , 'mid-mid': 'โผ'
, 'right': 'โ' , 'right-mid': 'โข' , 'middle': 'โ' }
});
table.push(
['foo', 'bar', 'baz']
, ['frob', 'bar', 'quuz']
);
console.log(table.toString());
// Outputs:
//
//โโโโโโโโคโโโโโโคโโโโโโโ
//โ foo โ bar โ baz โ
//โโโโโโโโผโโโโโโผโโโโโโโข
//โ frob โ bar โ quuz โ
//โโโโโโโโงโโโโโโงโโโโโโโ
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:
var table = new Table({ chars: {'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': ''} });
table.push(
['foo', 'bar', 'baz']
, ['frobnicate', 'bar', 'quuz']
);
console.log(table.toString());
// Outputs: (note the lack of the horizontal line between rows)
//โโโโโโโโโโโโโโฌโโโโโโฌโโโโโโโ
//โ foo โ bar โ baz โ
//โ frobnicate โ bar โ quuz โ
//โโโโโโโโโโโโโโดโโโโโโดโโโโโโโ
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:
var table = new Table({
chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
, 'right': '' , 'right-mid': '' , 'middle': ' ' },
style: { 'padding-left': 0, 'padding-right': 0 }
});
table.push(
['foo', 'bar', 'baz']
, ['frobnicate', 'bar', 'quuz']
);
console.log(table.toString());
// Outputs:
//foo bar baz
//frobnicate bar quuz
Clone the repository with all its submodules and run:
$ 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.
FAQs
WebJar for cli-table
We found that org.webjars.npm:cli-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.ย It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socketโs threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.