MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / patternSpecificity

Function patternSpecificity

packages/core/sdk/src/policies.ts:195–202  ·  view source on GitHub ↗
(pattern: string)

Source from the content-addressed store, hash-verified

193// `vercel.dns` → 5 (2 literal segments, exact — beats same-prefix wildcard)
194// `vercel.dns.create` → 7 (3 literal segments, exact)
195export const patternSpecificity = (pattern: string): number => {
196 if (pattern === "*") return 0;
197 if (pattern.endsWith(".*")) {
198 const prefix = pattern.slice(0, -2);
199 return prefix.split(".").length * 2;
200 }
201 return pattern.split(".").length * 2 + 1;
202};
203
204/**
205 * Position key for a new rule among an owner's existing rules, placed just

Callers 1

positionForNewPatternFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected