Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: GPT-6.1-Sol (Codex) <[email protected]> Co-authored-by: maria-rcks <[email protected]>
11 lines
440 B
TypeScript
11 lines
440 B
TypeScript
/** Readers for decoding undeclared provider payloads without trusting shapes. */
|
|
export function field(source: unknown, key: string): unknown {
|
|
return typeof source === "object" && source !== null ? Reflect.get(source, key) : undefined;
|
|
}
|
|
|
|
export function text(value: unknown): string | undefined {
|
|
if (typeof value !== "string") return undefined;
|
|
const trimmed = value.trim();
|
|
return trimmed.length === 0 ? undefined : trimmed;
|
|
}
|