columnizer
A text formatting utility for printing nice columns in terminal output.
Last updated 7 years ago by henrikjoreteg .
Repository · Original npm · Tarball · package.json
$ cnpm install columnizer 
SYNC missed versions from official npm registry.

columnizer

A simple tool for printing text in nice columns in the terminal.

Installing

npm install columnizer

How do I use it?

var columnizer = require('./columnizer');


var stooges = [
  {name: "Larry", height: "short", fat: false},
  {name: "Curly", height: "medium or tall", fat: false},
  {name: "Moe", height: "tall", fat: true}
];

// create an object to start with
var example = columnizer.create();

// call it's row method and pass in agruments
// each subsequent argument is another column

// first we'll add some column headers
example.row("Name", "Height", "Girth");

// then add some data (and do some tweaking of that);
stooges.forEach(function (stooge) {
  example.row(stooge.name, stooge.height, (stooge.fat) ? "corpulent" : "skinny");
});

// then when we're ready, just print it out:
example.print();

// will print this:
/*
Name     Height            Girth        
Larry    short             skinny       
Curly    medium or tall    skinny       
Moe      tall              corpulent    
*/

Licence

MIT

Current Tags

  • 0.1.0                                ...           latest (7 years ago)

7 Versions

  • 0.1.0                                ...           7 years ago
  • 0.0.6                                ...           8 years ago
  • 0.0.5                                ...           8 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |