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,
columnSeperator: ' | ',
headerSeperator: '='
});
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:
<div class="table row"><span class="table column">uid</span><span class="table column">name</span></div>
<div class="table row"><span class="table column">1</span><span class="table column">Doe</span></div>
<div class="table row"><span class="table column">2</span><span class="table column">Hemma</span></div>