hapi-transform-table
Advanced tools
Comparing version
@@ -11,4 +11,4 @@ const jsonToTable = require('json-to-table'); | ||
const rows = table.slice(1).reduce((tableString, n) => `${tableString}<tr><td>${n.join('</td><td>')}</td></tr>${os.EOL}`, ''); | ||
let css = options.css.map(link => `<link rel="stylesheet" type="text/css" href=${link}>`).join(os.EOL); | ||
css = `<style> | ||
const css = options.css.map(link => `<link rel="stylesheet" type="text/css" href="${link}">`).join(os.EOL); | ||
const cssFonts = `<style> | ||
body { | ||
@@ -19,3 +19,3 @@ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | ||
const scripts = options.scripts.map(link => `<script type="text/javascript" src="${link}"></script>`).join(os.EOL); | ||
return `${css}${css ? os.EOL : ''}${scripts}${scripts ? os.EOL : ''}<table${tableAttributes}>${os.EOL}${header}${os.EOL}<tbody>${rows}</tbody>${os.EOL}</table>`; | ||
return `${cssFonts}${os.EOL}${css}${os.EOL}${scripts}${os.EOL}<table${tableAttributes}>${os.EOL}${header}${os.EOL}<tbody>${rows}</tbody>${os.EOL}</table>`; | ||
}; | ||
@@ -22,0 +22,0 @@ |
{ | ||
"name": "hapi-transform-table", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "hapi plugin for routes that need to return json as HTML tables ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20483
0.04%