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

Function toPolicyPattern

packages/react/src/lib/policy-pattern.ts:21–29  ·  view source on GitHub ↗
(displayPattern: string)

Source from the content-addressed store, hash-verified

19// ---------------------------------------------------------------------------
20
21export const toPolicyPattern = (displayPattern: string): string => {
22 if (displayPattern === "*") return "*";
23 const firstDot = displayPattern.indexOf(".");
24 if (firstDot === -1) return displayPattern; // bare integration slug, no tail
25 const integration = displayPattern.slice(0, firstDot);
26 const rest = displayPattern.slice(firstDot + 1);
27 if (rest === "*") return displayPattern; // `integration.*` — trailing * is already a subtree
28 return `${integration}.*.*.${rest}`;
29};
30
31export { matchPattern };
32

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected