turtler

1.1.1 • Public • Published

turtler

🐢 Ascii tables made easy

Npm Version Build Status Coverage Status Dependency Status devDependency Status npm npm

Installation

npm install turtler --save

Usage

the given options are the defaults

let table = new Turtler([
  ["uid", "name"],
  ["1", "Doe"],
  ["2", "Hemma"]
], {
  hasHeader: true,
  columnSeparator: ' | ',
  headerSeparator: '='
});
 
console.log(table);

This will yield:

uid | name
===========
1   | Doe  
2   | Hemma

Markdown

We can also output markdown tables just as easily

let table = new Turtler([
  ["uid", "name"],
  ["1", "Doe"],
  ["2", "Hemma"]
]);
 
console.log(table.markdown());

This will yield:

| uid | name  |
|-----|-------|
| 1   | Doe   |
| 2   | Hemma |

Html

We can also output html tables just as easily

 
let table = new Turtler([
  ["uid", "name"],
  ["1", "Doe"],
  ["2", "Hemma"]
]);
 
console.log(table.html());
 

This will yield:

<table>
  <thead>
    <tr>
      <th>uid</th>
      <th>name</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>Doe</td>
    </tr>
    <tr>
      <td>2</td>
      <td>Hemma</td>
    </tr>
  </tbody>
</table>

Readme

Keywords

Package Sidebar

Install

npm i turtler

Weekly Downloads

4

Version

1.1.1

License

Apache-2.0

Unpacked Size

234 kB

Total Files

12

Last publish

Collaborators

  • gabrielcsapo