const table = {}
table.create = function (data, cols) {
let output = '
\n'
output += ' \n '
for (let column of cols) {
output += `${column.name} | `
}
output += '
\n \n'
output += ' \n'
for (let item of data) {
output += ' '
let i = 0
for (let prop in item) {
const column = cols[i]
let nowrap = column.nowrap ? ` nowrap` : ''
let align = column.align ? ` align="${column.align}"` : ''
output += `${item[prop]} | `
i++
}
output += '
\n'
}
output += ' \n'
output += '
'
return output
}
module.exports = table