Socket
Socket
Sign inDemoInstall

table-header

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    table-header

Add header to a text table


Version published
Weekly downloads
950
decreased by-44.57%
Maintainers
1
Install size
15.1 kB
Created
Weekly downloads
 

Readme

Source

npm

table-header

Build Status Dependency Status

Add header to a text table, with border.

Text table is array of rows of equal length:

var table = [
  ['red', '#ff0000'],
  ['green', '#00ff00'],
  ['blue', '#0000ff']
];

Example

var tableHeader = require('table-header');

tableHeader(table, ['color', 'code'])
//=> [
//     ['color', 'code'],
//     ['-----', '-------'],
//     ['red', '#ff0000'],
//     ['green', '#00ff00'],
//     ['blue', '#0000ff']
//   ]

API

tableHeader(table, header, [opts])

Returns a new table with header and the same data.

Options:

  • borderfalse for no border, true (default) for --delimited border, single-character string for custom-delimited border.

  • stringLength — string length function, e.g. to ignore escape codes.

tableHeader.add(table, header, [opts])

Add header to existing table, modifying it.

  • text-table module turns these tables to strings.
  • string-length — string length function that ignores escape codes.

Install

npm install table-header

License

MIT

Keywords

FAQs

Last updated on 05 Jun 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc