Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terminal-table

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terminal-table

View a table in the terminal.

  • 0.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31K
increased by8.12%
Maintainers
1
Weekly downloads
 
Created
Source

terminal-table

View a table in the terminal

screenshot

Features

  • To fit the width of the terminal can be displayed
  • Centered, right-justified
  • Corresponding to the full-width eastasianwidth
  • Coloring is possible colors.js
  • Border can choose from three styles and user custom style.

Installation

$ npm i terminal-table

Usage

var Table = require("terminal-table");
var t = new Table();

t.push(
  ["First", "Second"],
  ["Foo", "Bar"]
);

console.log("" + t);

API

Constructor options

  • borderStyle
    • 1: ascii
      screenshot
    • 2: unicode
      screenshot
    • 3: unicode bold
      screenshot
    • 0: user custom
      var t = new Table({
        borderStyle: 0,
        border: {
          sep: "║",
          topLeft: "╔", topMid: "╦", top: "═", topRight: "╗",
          midLeft: "╠", midMid: "╬", mid: "═", midRight: "╣",
          botLeft: "╚", botMid: "╩", bot: "═", botRight: "╝"
        }
      });
    
  • horizontalLine - Boolean
  • width - Array
new Table({
  width: [10, "50%", "50%"]
});
  • leftPadding, rightPadding

Methods

  • push(["item", "item2",,,],,,)
  • cell(row, column, text)
  • insertRow(rowIndex, ["item", ...])
  • insertColumn(columnIndex, ["item", ...])
  • attr(row, column, { attrs })
    • attrs
    • align: left, center, right
    • color: from colors.js, e.g. blue, red...
    • bg: blue, black...
  • attrRange({ range }, { attrs })
    • range
    • row: [start, end]
    • column: [start, end]
  • removeCell(row, column)
  • removeRow(row)
  • removeColumn(column)

Keywords

FAQs

Package last updated on 07 Apr 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc