Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
The table npm package is a utility for generating text-based tables for Node.js applications. It provides a simple yet flexible way to create and manipulate tables in the console or other text-based outputs. It supports custom borders, padding, alignment, and more, making it a versatile tool for displaying tabular data in a structured format.
Basic table creation
This feature allows you to create a simple table by providing an array of arrays. Each sub-array represents a row in the table. The first sub-array can be used for headers.
"use strict";\nconst {table} = require('table');\nlet data = [\n ['Name', 'Age'],\n ['Alice', 24],\n ['Bob', 19]\n];\nconsole.log(table(data));
Custom border styles
This feature allows customization of the table's border by using predefined border styles or creating custom ones. It enhances the visual appearance of the table.
"use strict";\nconst {table, getBorderCharacters} = require('table');\nlet config = {\n border: getBorderCharacters('ramac')\n};\nlet data = [\n ['Name', 'Age'],\n ['Alice', 24],\n ['Bob', 19]\n];\nconsole.log(table(data, config));
Column width and alignment
This feature allows you to specify the width and alignment of columns, providing control over the layout and presentation of data within the table.
"use strict";\nconst {table} = require('table');\nlet config = {\n columns: {\n 0: {\n width: 10,\n alignment: 'left'\n },\n 1: {\n width: 5,\n alignment: 'right'\n }\n }\n};\nlet data = [\n ['Name', 'Age'],\n ['Alice', 24],\n ['Bob', 19]\n];\nconsole.log(table(data, config));
cli-table is a similar package that provides functionalities for rendering unicode-aided tables on the command line. Compared to table, cli-table offers a different API and customization options but serves a similar purpose of displaying tabular data in CLI applications.
ascii-table is another package for creating ASCII tables in Node.js. It is simpler and less feature-rich compared to table, focusing on basic table creation without the extensive customization options that table provides.
(This library is work in progress. The working library will be released in 2.0.0.)
Formats data into a string table.
minWidth
, maxWidth
properties per column.Table data is described using an array of arrays.
let table = require('table'),
data;
data = [
['0A', '0B', '0C'],
['1A', '1B', '1C'],
['2A', '2B', '2C']
];
console.log(table(data));
FAQs
Formats data into a string table.
The npm package table receives a total of 11,792,535 weekly downloads. As such, table popularity was classified as popular.
We found that table demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.