JoshuaKGoldberg / console-table-without-index

The built-in Node.js console.table, but without the annoying (index) column. πŸ“Š
MIT License
7 stars 1 forks source link

console.table Without (index)

The built-in Node.js console.table, but without the annoying (index) column. πŸ“Š

πŸ‘ͺ All Contributors: 4 🀝 Code of Conduct: Kept πŸ§ͺ Coverage πŸ“ License: MIT πŸ“¦ npm version πŸ’ͺ TypeScript: Strict

Without this utility:

console.table([
    { emoji: "🍏", fruit: "apple" },
    { emoji: "🍌", fruit: "banana" },
    { emoji: "πŸ’", fruit: "cherry" },
]);
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ (index) β”‚ emoji β”‚ fruit    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0       β”‚ '🍏'  β”‚ 'apple'  β”‚
β”‚ 1       β”‚ '🍌'  β”‚ 'banana' β”‚
β”‚ 2       β”‚ 'πŸ’'  β”‚ 'cherry' β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Look at that (index) column! Wouldn't it be nice to get rid of it if you don't need it?

Usage

With this utility:

npm i console-table-without-index
import { table } from "console-table-without-index";

console.log(
    table([
        { emoji: "🍏", fruit: "apple" },
        { emoji: "🍌", fruit: "banana" },
        { emoji: "πŸ’", fruit: "cherry" },
    ]),
);
β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ emoji β”‚ fruit    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ '🍏'  β”‚ 'apple'  β”‚
β”‚ '🍌'  β”‚ 'banana' β”‚
β”‚ 'πŸ’'  β”‚ 'cherry' β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Hooray! No more (index)! πŸ™Œ

Contributors

Craigory Coppola
Craigory Coppola

πŸ€”
Josh Goldberg ✨
Josh Goldberg ✨

πŸ’» πŸ–‹ πŸ“– πŸ€” πŸš‡ 🚧 πŸ“† πŸ”§
Malcolm
Malcolm

πŸ›
fisker Cheung
fisker Cheung

πŸ’»

πŸ’™ This package was templated with create-typescript-app.