MCPcopy Create free account
hub / github.com/clawbot7/cli-gateway / extractStringArray

Function extractStringArray

src/gateway/bindingRuntime.ts:1028–1039  ·  view source on GitHub ↗
(root: unknown, paths: string[])

Source from the content-addressed store, hash-verified

1026}
1027
1028function extractStringArray(root: unknown, paths: string[]): string[] {
1029 for (const p of paths) {
1030 const value = getPathValue(root, p);
1031 if (!Array.isArray(value)) continue;
1032 const out = value
1033 .filter((item): item is string => typeof item === 'string')
1034 .map((item) => item.trim())
1035 .filter(Boolean);
1036 if (out.length > 0) return out;
1037 }
1038 return [];
1039}
1040
1041function getPathValue(root: unknown, pathExpr: string): unknown {
1042 const segments = pathExpr.split('.');

Callers 1

extractCommandHintFunction · 0.70

Calls 1

getPathValueFunction · 0.70

Tested by

no test coverage detected