-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.js
32 lines (22 loc) · 863 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 = new Columnizer;
// 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();
// should be able to just add them.
var example2 = new Columnizer(stooges);
example2.print(10, true);
console.log("example table has 4 rows: " + (example.length() === 4));