(text: string)
| 240 | * silently stops matching. |
| 241 | */ |
| 242 | export 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. */ |
| 255 | export const SEQUENCE_PARTICIPANT_CAP = 12; |
no outgoing calls
no test coverage detected