* Wraps content in an HTML tag, adding any HTML attributes * * @param {string} tag HTML tag to wrap * @param {string | null} content content within the tag * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add * * @returns {string} conten
(tag, content, attrs = {})
| 19588 | * @returns {string} content wrapped in HTML element |
| 19589 | */ |
| 19590 | wrap(tag, content, attrs = {}) { |
| 19591 | const htmlAttrs = Object.entries(attrs).map(([key, value]) => ` ${key}="${value}"`).join(""); |
| 19592 | if (!content) { |
| 19593 | return `<${tag}${htmlAttrs}>`; |
| 19594 | } |
| 19595 | return `<${tag}${htmlAttrs}>${content}</${tag}>`; |
| 19596 | } |
| 19597 | /** |
| 19598 | * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. |
| 19599 | * |
no test coverage detected