1export function field(source: unknown, key: string): unknown {
2 return typeof source === "object" && source !== null ? Reflect.get(source, key) : undefined;
3}
4
5export function text(value: unknown): string | undefined {
6 if (typeof value !== "string") return undefined;
7 const trimmed = value.trim();
8 return trimmed.length === 0 ? undefined : trimmed;
9}