Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
text-table
Advanced tools
Package description
The text-table npm package is a utility for formatting data into a table-like structure using plain text. It is useful for creating simple, readable tables in console applications or for formatting data in a tabular form without the need for HTML or graphical interfaces.
Simple table creation
This feature allows you to create a simple text-based table with rows of data. Each sub-array represents a row in the table.
var table = require('text-table');
var t = table([
['master', '0123456789abcdef', 'Initial commit'],
['test', 'fedcba9876543210', 'Work in progress']
]);
console.log(t);
Alignment and padding
This feature allows you to specify alignment and padding for the columns in the table. The 'align' option takes an array of characters representing the alignment for each column ('.' for right, '-' for left). The 'hsep' option specifies a horizontal separator.
var table = require('text-table');
var t = table([
['beep', '1024'],
['boop', '33450'],
['foo', '1006'],
['bar', '45']
], { align: ['.','-'], hsep: ' | ' });
console.log(t);
cli-table is a package that provides similar functionality to text-table, allowing for table creation in the console. It offers additional features such as customizable borders, header columns, and cell coloring, which can make the tables more visually appealing and easier to read.
The 'table' package is another alternative to text-table that provides a rich set of features for creating and formatting tables in the console. It supports advanced features like column width calculation, text wrapping, and alignment, making it a more powerful tool for complex table layouts.
ascii-table is a lightweight package for creating ASCII tables. It is similar to text-table but offers a fluent API for building and styling tables, which can be more intuitive for some users. However, it may not be as minimalistic as text-table for simple table creation.
Readme
generate borderless text table strings suitable for printing to stdout
var table = require('text-table');
var t = table([
[ 'master', '0123456789abcdef' ],
[ 'staging', 'fedcba9876543210' ]
]);
console.log(t);
master 0123456789abcdef
staging fedcba9876543210
var table = require('text-table');
var t = table([
[ 'beep', '1024' ],
[ 'boop', '33450' ],
[ 'foo', '1006' ],
[ 'bar', '45' ]
], { align: [ 'l', 'r' ] });
console.log(t);
beep 1024
boop 33450
foo 1006
bar 45
var table = require('text-table');
var t = table([
[ 'beep', '1024' ],
[ 'boop', '334.212' ],
[ 'foo', '1006' ],
[ 'bar', '45.6' ],
[ 'baz', '123.' ]
], { align: [ 'l', '.' ] });
console.log(t);
beep 1024
boop 334.212
foo 1006
bar 45.6
baz 123.
var table = require('text-table');
var t = table([
[ 'beep', '1024', 'xyz' ],
[ 'boop', '3388450', 'tuv' ],
[ 'foo', '10106', 'qrstuv' ],
[ 'bar', '45', 'lmno' ]
], { align: [ 'l', 'c', 'l' ] });
console.log(t);
beep 1024 xyz
boop 3388450 tuv
foo 10106 qrstuv
bar 45 lmno
var table = require('text-table')
Return a formatted table string s
from an array of rows
and some options
opts
.
rows
should be an array of arrays containing strings, numbers, or other
printable values.
options can be:
opts.hsep
- separator to use between columns, default ' '
opts.align
- array of alignment types for each column, default ['l','l',...]
alignment types are:
'l'
- left'r'
- right'c'
- center'.'
- decimalWith npm do:
npm install text-table
MIT
FAQs
borderless text tables with alignment
We found that text-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.