README
tables.js is a module to create tables
Installation
npm install tables.js
Example: horizontal 2x2 table
var table = require("tables.js");
var firstTable = table.horizontal2x2({
"size": 3,
"header": ["Red", "Green", "Blue"],
"input": ["votes: 400", "votes: 323", "votes: 208"]
});
console.log(firstTable);
this is an example so this is not the reall result of color votes
In the console
╔═══════╦════════════╗
║ Red ║ votes: 400 ║
╠═══════╬════════════╣
║ Green ║ votes: 323 ║
╠═══════╬════════════╣
║ Blue ║ votes: 208 ║
╚═══════╩════════════╝
Example: horizontal Custom
var table = require("tables.js");
var firstTable = table.horizontalCust({
"columnHo": 3,
"columnVe": 4,
"header": ["My cars", "First one", "Second one", "third one"],
"input": [["Speed", "100km/h", "345km/h", "120km/h"], ["Color", "Red", "Yellow", "Black"]]
});
console.log(firstTable);
In the console
╔════════════╦═════════╦════════╗
║ My cars ║ Speed ║ Color ║
╠════════════╬═════════╬════════╣
║ First one ║ 100km/h ║ Red ║
╠════════════╬═════════╬════════╣
║ Second one ║ 345km/h ║ Yellow ║
╠════════════╬═════════╬════════╣
║ third one ║ 120km/h ║ Black ║
╚════════════╩═════════╩════════╝
Functions
horizontal2x2(options)
horizontalCust(options)
options
for the options
options for horizontal2x2{
size: (number) the size of the table
header: (array)
input: (array)
}
options for horizontalCust{
columnHo: (number) how many column you want (horizontaly)
columnVe: (number) how many column you want (verticaly)
header: (array)
input: (array)
}