* Checks if a string contains unescaped empty parentheses "()". * Returns true only if both the "(" and ")" are unescaped and adjacent.
(str: string)
| 41 | * Returns true only if both the "(" and ")" are unescaped and adjacent. |
| 42 | */ |
| 43 | function 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 |
no test coverage detected