-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathtest.js
59 lines (51 loc) · 1.04 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var tableify = require('./');
var assert = require('assert');
var fs = require('fs');
var html = fs.readFileSync('test.html','utf8');
var obj = {
test : {
data : [
{ a : 1, b : 2, c : 'testing' }
, { a : 4, b : 5, c : 'something' }
, { a : 5, b : 8, c : 'something else' }
, { a : 534, b : 23423, c : {
noodle : 'pie'
, cake : 'sandwich'
, parsley : 'boat'
}
}
]
}
, fish : [
{ a : 'penguin' }
, { a : 'linguine' }
, { c : 'cow' }
, { d : [
{ name : 'the thing'}
, { name : 'steve dave' }
, { name : 'the hulk' }
, { name : null }
, { name : undefined }
]}
]
, valuesArray : [
'abcdefg'
, 'asdfasdf'
, 'asdf'
, 'asdf'
]
, twodee : [
[ 1234, 1234 ]
, [ 2345, 2345 ]
, [ 3456, 3456 ]
]
};
//create a circular reference
obj.fish[0].b = obj.fish;
//console.log(tableify(obj));
//console.log(html);
assert.equal(tableify(obj) + '\n', html);
t = tableify.defaults({ classes : false })
console.log(t(obj))
t = tableify.defaults({ classPrefix : 'tblfy-' })
console.log(t(obj))