Quick Start

Getting started with voici.js

Install voici.js using your desired package manager:

npm i --save voici.js

Provide a dataset and print it:

import { Table } from 'voici.js'

const data = [
  { firstname: 'Homer', lastname: 'Simpson', age: 39 },
  { firstname: 'Marge', lastname: 'Simpson', age: 36 },
  { firstname: 'Bart', lastname: 'Simpson', age: 10 },
  { firstname: 'Lisa', lastname: 'Simpson', age: 8 },
  { firstname: 'Maggie', lastname: 'Simpson', age: 1 }
];

const table = new Table(data);
table.print();

The output:

By default, the width of each column depends on the length of the values it contains. Instead of objects you can also provide arrays in your dataset.

Call .print(true) to clear the console before printing.

Last updated