(text)
| 123 | } |
| 124 | |
| 125 | export function sanitizeMarkdown(text) { |
| 126 | if (typeof text !== 'string') return ''; |
| 127 | |
| 128 | return text |
| 129 | .replace(/\*/g, '\\*') |
| 130 | .replace(/_/g, '\\_') |
| 131 | .replace(/`/g, '\\`') |
| 132 | .replace(/\[/g, '\\[') |
| 133 | .replace(/\]/g, '\\]') |
| 134 | .replace(/\|/g, '\\|') |
| 135 | .replace(/~/g, '\\~'); |
| 136 | } |
| 137 | |
| 138 | export function sanitizeInput(input, maxLength = 2000) { |
| 139 | if (typeof input !== 'string') return ''; |
no outgoing calls
no test coverage detected