const table = {} table.create = function (data, cols) { let output = '\n' output += ' \n ' for (let column of cols) { output += `` } 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 += '
${column.name}
' return output } module.exports = table