MCPcopy
hub / github.com/anomalyco/opencode / all

Function all

packages/opencode/src/util/wildcard.ts:21–31  ·  view source on GitHub ↗
(input: string, patterns: Record<string, any>)

Source from the content-addressed store, hash-verified

19}
20
21export function all(input: string, patterns: Record<string, any>) {
22 const sorted = pipe(patterns, Object.entries, sortBy([([key]) => key.length, "asc"], [([key]) => key, "asc"]))
23 let result = undefined
24 for (const [pattern, value] of sorted) {
25 if (match(input, pattern)) {
26 result = value
27 continue
28 }
29 }
30 return result
31}
32
33export function allStructured(input: { head: string; tail: string[] }, patterns: Record<string, any>) {
34 const sorted = pipe(patterns, Object.entries, sortBy([([key]) => key.length, "asc"], [([key]) => key, "asc"]))

Callers 3

index.tsFile · 0.50
auth.tsFile · 0.50
registry.tsFile · 0.50

Calls 2

pipeFunction · 0.85
matchFunction · 0.70

Tested by

no test coverage detected