(root: unknown, paths: string[])
| 1026 | } |
| 1027 | |
| 1028 | function 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 | |
| 1041 | function getPathValue(root: unknown, pathExpr: string): unknown { |
| 1042 | const segments = pathExpr.split('.'); |
no test coverage detected