(pattern: string)
| 103 | }; |
| 104 | |
| 105 | export const isValidPattern = (pattern: string): boolean => { |
| 106 | if (pattern.length === 0) return false; |
| 107 | if (pattern === "*") return true; |
| 108 | if (pattern.startsWith(".") || pattern.endsWith(".")) return false; |
| 109 | if (pattern.includes("..")) return false; |
| 110 | if (pattern.startsWith("*")) return false; |
| 111 | const segments = pattern.split("."); |
| 112 | for (let i = 0; i < segments.length; i++) { |
| 113 | const seg = segments[i]!; |
| 114 | if (seg.length === 0) return false; |
| 115 | // A `*` segment must be the WHOLE segment — no partial wildcards (`me*`). |
| 116 | // A `*` is valid mid-pattern (one segment) or trailing (subtree). |
| 117 | if (seg.includes("*") && seg !== "*") return false; |
| 118 | } |
| 119 | return true; |
| 120 | }; |
| 121 | |
| 122 | // --------------------------------------------------------------------------- |
| 123 | // Resolution — each owner contributes its first matching rule by local |
no outgoing calls
no test coverage detected