New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

table-log

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table-log

CLI logging utility that logs lines as vertically aligned tabular data

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

table-log

NPM utility tool to log lines as vertically aligned tabular data.

Demo

Get Started

Install the tool via yarn add table-log or npm i table-log --save. Then import the utility via

import { CliTable } from 'table-log';

Then, initialize a new table with table = CliTable.createNoBorderTable(), and invoke table.log(...lines) to log a new line. The table is automatically adjusted whenever a new longest cell is logged.

Complete example:

import { CliTable } from 'table-log';

const table = CliTable.createNoBorderTable({
  // Optional column alignments
  colAligns: ['left', 'right', 'left', 'right'],
  
  // Optional maximum column widths
  colWidths: [undefined, undefined, 35, undefined]
});

table.log('Received', 'GET', '/users/obi-wan-kenobi', '(352ms)');
table.log('Received', 'GET', '/users/vader', '(241ms)');
table.log('Received', 'POST', '/lightsabers/red/vader', '(890ms)');
table.log('Received', 'POST', '/lightsabers/blue/obi-wan-kenobi', '(937ms)');
table.log('Received', 'OPTIONS', '/lightsabers/new', '(125ms)');
table.log('Received', 'PUT', '/lightsabers/new', '(11,335ms)');
table.log('Received', 'GET', '/users/yoda', '(452ms)');
table.log('Received', 'POST', '/lightsabers/green/yoda', '(676ms)');

// There may also pass some time between renders
await new Promise(r => setTimeout(r, 2000));

table.log('Received', 'GET', '/lightsabers/green/yoda/handle/material', '(124ms)');

table.unmount();

console.log("Table unmounted!");

You can also create a table with a border, by invoking CliTable.createSingleBorderTable() or CliTable.createDoubleBorderTable() instead of CliTable.createNoBorderTable().

Demo Demo

Keywords

cli

FAQs

Package last updated on 30 Apr 2021

Did you know?

Socket

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.

Install

Related posts