Notoriously Psychedelic Modules

npm

Need private packages and team management tools?Check out npm Orgs. »

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>

Keywords

install

npm i turtler

Downloadsweekly downloads

34

version

1.1.1

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability