* Safely get a nested string value from an object.
(obj: Record<string, unknown>, path: string)
| 413 | * Safely get a nested string value from an object. |
| 414 | */ |
| 415 | function getNestedString(obj: Record<string, unknown>, path: string): string | undefined { |
| 416 | const parts = path.split('.') |
| 417 | let current: unknown = obj |
| 418 | |
| 419 | for (const part of parts) { |
| 420 | if (current === null || typeof current !== 'object') { |
| 421 | return undefined |
| 422 | } |
| 423 | current = (current as Record<string, unknown>)[part] |
| 424 | } |
| 425 | |
| 426 | return typeof current === 'string' ? current : undefined |
| 427 | } |
| 428 | |
| 429 | // ============================================================================= |
| 430 | // Organization Types |
no outgoing calls
no test coverage detected