voici.js
GitHubTypeDocnpm☕
  • 🏠Home
  • ⚡Quick Start
  • 💡Examples
    • Styling
      • Alignment
      • Colors
      • Border
      • Padding
      • Width
      • Font Style
    • Sorting
    • Highlighting
    • Accumulation
    • Columns
      • Sort Columns
      • Selected Columns
      • Rename Columns
      • Dynamic Columns
    • Arrays
    • Fill Empty
    • Export
    • Typescript
    • Printing
  • 🧩Contributing
  • Reference
    • 📖API Reference
      • AccumulationFunction
      • Config
      • Sort
      • Table
    • ❓FAQ
    • ❗Issues
Powered by GitBook
On this page

Was this helpful?

Quick Start

Getting started with voici.js

PreviousHomeNextExamples

Last updated 3 years ago

Was this helpful?

Install voici.js using your desired package manager:

npm i --save voici.js
yarn add 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:

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

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

⚡
arrays
Console Output