MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / escapeHtml

Function escapeHtml

bs/bs.ts:160–178  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

158}
159
160function escapeHtml(text: string): string {
161 const escaped = (text || "").replace(/[&<>"']/g, (ch) => {
162 switch (ch) {
163 case "&":
164 return "&amp;";
165 case "<":
166 return "&lt;";
167 case ">":
168 return "&gt;";
169 case '"':
170 return "&quot;";
171 case "'":
172 return "&#x27;";
173 default:
174 return ch;
175 }
176 });
177 return escaped.replace(/\n/g, "<br>");
178}
179
180function escapeAttribute(text: string): string {
181 return (text || "").replace(/[&<>"]/g, (ch) => {

Callers 7

formatEntityFunction · 0.70
renderTargetFunction · 0.70
forwardToTargetFunction · 0.70
sendSourceFeedbackFunction · 0.70
sendTargetFeedbackFunction · 0.70
bs.tsFile · 0.70
BsPluginClass · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected