MCPcopy Create free account
hub / github.com/codeaashu/claude-code / escapeRuleContent

Function escapeRuleContent

src/utils/permissions/permissionRuleParser.ts:55–60  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

53 * escapeRuleContent('echo "test\\nvalue"') // => 'echo "test\\\\nvalue"'
54 */
55export function escapeRuleContent(content: string): string {
56 return content
57 .replace(/\\/g, '\\\\') // Escape backslashes first
58 .replace(/\(/g, '\\(') // Escape opening parentheses
59 .replace(/\)/g, '\\)') // Escape closing parentheses
60}
61
62/**
63 * Unescapes special characters in rule content after parsing from permission rules.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected