trtd
v0.0.1
Published
Render Html table from object
Readme
trtd
Render Html table from object
install
npm install trtdusage
var trtd = require("trtd")
var html = trtd({ head : "object"}, { body : "object"})API
trtd( head, body , [ opt ] )
headArrayorObjectorundefined- Rendered as head.
- If
undefined, only render
bodyArrayorObject- Render as body.
optObjectpretty(defaulttrue) : pretty print flagindent_size(default2) : html indet size
Example
<table>
<tr>
<th>parameter</th>
<th>description</th>
</tr>
<tr>
<td>foo</td>
<td>hogehoge</td>
</tr>
<tr>
<td>baz</td>
<td>fugafuga</td>
</tr>
</table>If you want get above html, can these parameters.
- head = object, body = object
var head = {
param: 'parameter',
desc: 'description'
}
var body = {
foo: {
desc: 'hogehoge'
},
baz: {
desc: 'fugafuga'
}
}
trtd(head, body)- head = object, body = array
var head = {
param: 'parameter',
desc: 'description'
}
var body =[
{
param: 'foo',
desc: 'hogehoge'
},
{
desc: 'fugafuga',
param: 'baz'
}
]
trtd(head, body)- head = array , body = array
var head = [
'parameter',
'description'
]
var body =[
{
parameter: 'foo',
description: 'hogehoge'
},
{
description: 'fugafuga',
parameter: 'baz'
}
]
trtd(head, body)