MCPcopy Index your code
hub / github.com/codeaashu/claude-code / countUnescapedChar

Function countUnescapedChar

src/utils/settings/permissionValidation.ts:29–37  ·  view source on GitHub ↗

* Counts unescaped occurrences of a character in a string. * A character is considered escaped if preceded by an odd number of backslashes.

(str: string, char: string)

Source from the content-addressed store, hash-verified

27 * A character is considered escaped if preceded by an odd number of backslashes.
28 */
29function countUnescapedChar(str: string, char: string): number {
30 let count = 0
31 for (let i = 0; i < str.length; i++) {
32 if (str[i] === char && !isEscaped(str, i)) {
33 count++
34 }
35 }
36 return count
37}
38
39/**
40 * Checks if a string contains unescaped empty parentheses "()".

Callers 1

validatePermissionRuleFunction · 0.85

Calls 1

isEscapedFunction · 0.85

Tested by

no test coverage detected