(value: unknown)
| 37 | |
| 38 | /** Returns the first non-empty string in an array (or `undefined`). */ |
| 39 | export function firstNonEmpty(value: unknown): string | undefined { |
| 40 | if (!Array.isArray(value)) return undefined |
| 41 | for (const item of value) { |
| 42 | const s = str(item) |
| 43 | if (s) return s |
| 44 | } |
| 45 | return undefined |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Splits a full name into first / last for providers whose API requires both |