MCPcopy Index your code
hub / github.com/simstudioai/sim / decodeHtmlEntities

Function decodeHtmlEntities

apps/sim/lib/mothership/inbox/format.ts:132–134  ·  view source on GitHub ↗

* Decodes known HTML entities in a single pass to avoid double-unescaping. * A two-step decode (e.g. `&amp;` -> `&` then `&lt;` -> `<`) would turn * `&amp;lt;` into `<`, which is incorrect.

(text: string)

Source from the content-addressed store, hash-verified

130 * `&amp;lt;` into `<`, which is incorrect.
131 */
132function decodeHtmlEntities(text: string): string {
133 return text.replace(/&(?:nbsp|amp|lt|gt|quot|#39);/g, (match) => HTML_ENTITY_MAP[match] ?? match)
134}
135
136/**
137 * Basic HTML to text extraction.

Callers 1

extractTextFromHtmlFunction · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected