Hi. I wrote a little utility <https://github.com/eldargab/easy-table> for
rendering text tables with javascript. Probably someone else will find it
useful.
The brief example is:
var Table = require('easy-table');
var data = [
{ id: 123123, desc: 'Something awesome', price: 1000.00 },
{ id: 245452, desc: 'Very interesting book', price: 11.45},
{ id: 232323, desc: 'Yet another product', price: 555.55 }]
var t = new Table;
data.forEach(function (product) {
t.cell('Product Id', product.id);
t.cell('Description', product.desc);
t.cell('Price, USD', product.price.toFixed(2), Table.padLeft);
t.newLine();});
console.log(t.toString());
The snippet above will result in:
Product Id Description Price, USD
---------- --------------------- ----------
123123 Something awesome 1000.00
245452 Very interesting book 11.45
232323 Yet another product 555.55
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en