MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / escapeHtml

Function escapeHtml

src/components/formatTooltip.ts:5–14  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

3const EM_DASH = '\u2014';
4
5function escapeHtml(text: string): string {
6 // Escapes text for safe insertion into HTML text/attribute contexts.
7 // (We only use it for text nodes here, but keeping it generic is fine.)
8 return text
9 .replace(/&/g, '&')
10 .replace(/</g, '&lt;')
11 .replace(/>/g, '&gt;')
12 .replace(/"/g, '&quot;')
13 .replace(/'/g, '&#39;');
14}
15
16function formatNumber(value: number): string {
17 if (!Number.isFinite(value)) return EM_DASH;

Callers 3

formatRowHtmlFunction · 0.70
formatCandlestickRowHtmlFunction · 0.70
formatTooltipAxisFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected