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

asciitable

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

asciitable

Render tables in text for tabular terminal fun times!

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
141
decreased by-7.24%
Maintainers
1
Weekly downloads
 
Created
Source

asciitable

Render tables in text for tabular terminal fun times!

Overview

asciitable is the result of me extracting some code from another project. It can render simple tables with headings and pretty hyphen/pipe character-based formatting.

Installation

Available via npm:

$ npm install asciitable

Or via git:

$ git clone git://github.com/deoxxa/asciitable.git node_modules/asciitable

API

asciitable

Generates a table! Easy as pie!

var table = asciitable(options, data);

// OR

var table = asciitable(data, options);

// OR

var table = asciitable(data);
// basic table
var table = asciitable([
  {a: "a", b: "b", c: "c"},
  {a: "asddsfa", b: "sss", c: "zxc"},
  {a: "dsgvdgsdvgssdf", b: "x", c: "eryty"},
  {a: "m", b: "n", c: "o", d: "p"},
]);

console.log(table);

Arguments

  • options - an object specifying some things about the table you want generated. Options are optional.
  • data - an array of objects.

Options

  • fields - an array of field names you want to display. If omitted, asciitable will try to figure out what all the fields are for all the objects in the data array.
  • plusIntersections - enables using a + character at line intersections. Default is false. Or undefined. Whatever, default is "not enabled".

Example

Also see example.js.

var asciitable = require("asciitable");

var table = asciitable([
  {a: "a", b: "b", c: "c"},
  {a: "asddsfa", b: "sss", c: "zxc"},
  {a: "dsgvdgsdvgssdf", b: "x", c: "eryty"},
  {a: "m", b: "n", c: "o", d: "p"},
  {a: 5, b: null, c: {}, d: []},
  {a: function(){}},
]);

console.log(table);

Output:

-------------------------------------------------
 | a              | b    | c               | d |
-------------------------------------------------
 | a              | b    | c               |   |
 | asddsfa        | sss  | zxc             |   |
 | dsgvdgsdvgssdf | x    | eryty           |   |
 | m              | n    | o               | p |
 | 5              | null | [object Object] |   |
 | function (){}  |      |                 |   |
-------------------------------------------------

License

3-clause BSD. A copy is included with the source.

Contact

Keywords

FAQs

Package last updated on 06 Mar 2013

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