| 1 | /** Readers for decoding undeclared provider payloads without trusting shapes. */ |
| 2 | export function field(source: unknown, key: string): unknown { |
| 3 | return typeof source === "object" && source !== null ? Reflect.get(source, key) : undefined; |
| 4 | } |
| 5 | |
| 6 | export function text(value: unknown): string | undefined { |
| 7 | if (typeof value !== "string") return undefined; |
| 8 | const trimmed = value.trim(); |
| 9 | return trimmed.length === 0 ? undefined : trimmed; |
| 10 | } |