File size: 604 Bytes
e81f4e4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | export type UnknownRecord = Record<string, unknown>;
export type ErrorWithMetadata = Error & {
code?: string;
status?: number;
promptBytes?: number;
promptBytesExact?: boolean;
thresholdBytes?: number;
upstreamStatus?: number;
rawLength?: number | null;
reason?: string;
cause?: unknown;
};
export function isRecord(value: unknown): value is UnknownRecord {
return !!value && typeof value === "object" && !Array.isArray(value);
}
export function firstRecord(...values: unknown[]): UnknownRecord | null {
for (const value of values) {
if (isRecord(value)) return value;
}
return null;
}
|