MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sanitizeLabel

Function sanitizeLabel

graph-ui/src/pseudocode/flow-model.ts:242–252  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

240 * silently stops matching.
241 */
242export function sanitizeLabel(text: string): string {
243 const flattened = text
244 // A newline inside a label ends the statement it sits in, and every
245 // other control character is invisible in the drawing and confusing in
246 // the source, so the whole range becomes one space.
247 .replace(/[\u0000-\u001F\u007F]+/g, ' ')
248 .replace(/["'`;#<>[\]{}|]/g, '')
249 .replace(/\s+/g, ' ')
250 .trim();
251 return flattened.length > LABEL_CAP ? `${flattened.slice(0, LABEL_CAP - 1).trimEnd()}.` : flattened;
252}
253
254/** How many lifelines one sequence box draws before the rest are left out. */
255export const SEQUENCE_PARTICIPANT_CAP = 12;

Callers 5

flow-model.test.tsFile · 0.90
loopsOfFunction · 0.90
flowHighlightOfFunction · 0.85
flowSequenceFunction · 0.85
moduleLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected