turtler
v1.1.1
Published
🐢 Ascii tables made easy
Downloads
42
Readme
turtler
🐢 Ascii tables made easy
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>