MCPcopy
hub / github.com/codeaashu/claude-code / hasUnescapedEmptyParens

Function hasUnescapedEmptyParens

src/utils/settings/permissionValidation.ts:43–53  ·  view source on GitHub ↗

* Checks if a string contains unescaped empty parentheses "()". * Returns true only if both the "(" and ")" are unescaped and adjacent.

(str: string)

Source from the content-addressed store, hash-verified

41 * Returns true only if both the "(" and ")" are unescaped and adjacent.
42 */
43function hasUnescapedEmptyParens(str: string): boolean {
44 for (let i = 0; i < str.length - 1; i++) {
45 if (str[i] === '(' && str[i + 1] === ')') {
46 // Check if the opening paren is unescaped
47 if (!isEscaped(str, i)) {
48 return true
49 }
50 }
51 }
52 return false
53}
54
55/**
56 * Validates permission rule format and content

Callers 1

validatePermissionRuleFunction · 0.85

Calls 1

isEscapedFunction · 0.85

Tested by

no test coverage detected