Grid for code-blocs and console
Install
npm install console-gridlist@latest
Syntaxe
let title = "title"
let head = ["","","",...]
let body = [
["","","",...],
["","","",...],
["","","",...],
...
]
console.log( grid( title, head, body))
Good to know
All arrays in the body must be the same length as the head array. A title setting will be added in future releases. The size of the grid depends on the size of the elements that are displayed.
Example
const grid = require("console-gridlist")
let example = grid("Classement",
"id→,name,←age",
[
["1","patrick","20"],
"2,bob,30",
{id:3,name:"louis",age:21}
]
)
console.log(example)
Result
╔════════════════════╗
║ Classement ║
╠════╦═════════╦═════╣
║ id ║ name ║ age ║
╠════╬═════════╬═════╣
║ 1 ║ patrick ║ 20 ║
║ 2 ║ bob ║ 30 ║
║ 3 ║ louis ║ 21 ║
╚════╩═════════╩═════╝