MCPcopy
hub / github.com/lowlighter/metrics / demos

Function demos

source/app/metrics/metadata.mjs:651–681  ·  view source on GitHub ↗
({colspan = null, wrap = false, examples = {}} = {})

Source from the content-addressed store, hash-verified

649
650//Demo for main and individual readmes
651function demos({colspan = null, wrap = false, examples = {}} = {}) {
652 if (("default1" in examples) && ("default2" in examples)) {
653 return [
654 wrap ? '<td colspan="2"><table><tr>' : "",
655 '<td align="center">',
656 `<img src="${examples.default1}" alt=""></img>`,
657 "</td>",
658 '<td align="center">',
659 `<img src="${examples.default2}" alt=""></img>`,
660 "</td>",
661 wrap ? "</tr></table></td>" : "",
662 ].filter(v => v).join("\n")
663 }
664 return [
665 ` <td ${colspan ? `colspan="${colspan}"` : ""} align="center">`,
666 `${
667 Object.entries(examples).map(([text, link]) => {
668 let img = `<img src="${link}" alt=""></img>`
669 if (text !== "default") {
670 const open = text.charAt(0) === "+" ? " open" : ""
671 text = open ? text.substring(1) : text
672 text = `${text.charAt(0).toLocaleUpperCase()}${text.substring(1)}`
673 img = `<details${open}><summary>${text}</summary>${img}</details>`
674 }
675 return ` ${img}`
676 }).join("\n")
677 }`,
678 ' <img width="900" height="1" alt="">',
679 " </td>",
680 ].filter(v => v).join("\n")
681}

Callers 1

metadata.mjsFile · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected