import _ from "lodash"; import {beautify} from "../formatter/html"; const convert = (json = [], {header = true} = {}) => { if (!_.isArray(json) || json.length < 1) { return "" } let html = [""]; let keys = Object.keys(json[0]) if (header) { html.push( '', '', ...keys.map((item) => { return `` }), '', '' ) } html.push("") for (let row of json) { html.push("", ...keys.map((item) => { return `` }), ''); } html.push("
${item}
${item in row ? row[item] : ""}
") return beautify(html.join("")) } export default convert