(record: Record<string, unknown>, key: string)
| 364 | } |
| 365 | |
| 366 | function optionalString(record: Record<string, unknown>, key: string): string | undefined { |
| 367 | const value = record[key]; |
| 368 | if (value === undefined) return undefined; |
| 369 | if (typeof value !== 'string' || value.length === 0) { |
| 370 | throw new Error(`Expected ${key} to be a non-empty string.`); |
| 371 | } |
| 372 | return value; |
| 373 | } |
| 374 | |
| 375 | export function requiredNumber(record: Record<string, unknown>, key: string): number { |
| 376 | const value = record[key]; |
no outgoing calls
no test coverage detected
searching dependent graphs…