var CARD_DETAILS = { image: `
thumbnail
`, main: `

<::title::>

icon

<::description::>

`, extra: `
<::type::><::language::>
`, }; export default function getHTMLDetails( data: { title: string; description: string; icon: string; image?: string; }, show: { image: boolean; extra: boolean } ) { var html = ""; if (show.image) { html += CARD_DETAILS.image; } html += CARD_DETAILS.main; if (show.extra) { html += CARD_DETAILS.extra; } Object.keys(data).forEach((key: string) => { html = html.replace(new RegExp(`<::${key}::>`, "g"), data[key]); }); return html; }