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

Function extractStringArray

src/channels/discord.ts:778–791  ·  view source on GitHub ↗
(root: unknown, paths: string[])

Source from the content-addressed store, hash-verified

776}
777
778function extractStringArray(root: unknown, paths: string[]): string[] {
779 for (const pathExpr of paths) {
780 const value = getPathValue(root, pathExpr);
781 if (!Array.isArray(value)) continue;
782 const out = value
783 .filter((item): item is string => typeof item === 'string')
784 .map((item) => item.trim())
785 .filter(Boolean);
786 if (out.length > 0) return out;
787 }
788
789 const fallbackKeys = collectPermissionKeyAliases(paths);
790 return extractDeepStringArrayByKeys(root, fallbackKeys);
791}
792
793function getPathValue(root: unknown, pathExpr: string): unknown {
794 const segments = pathExpr.split('.');

Callers 1

extractCommandFunction · 0.70

Calls 3

getPathValueFunction · 0.70

Tested by

no test coverage detected