(root: unknown, paths: string[])
| 776 | } |
| 777 | |
| 778 | function 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 | |
| 793 | function getPathValue(root: unknown, pathExpr: string): unknown { |
| 794 | const segments = pathExpr.split('.'); |
no test coverage detected