( out: Record<string, unknown>, snakeKey: string, value: Record<string, T> | undefined, toToml: (v: T, raw: unknown) => Record<string, unknown>, )
| 497 | } |
| 498 | |
| 499 | function setRecordSection<T>( |
| 500 | out: Record<string, unknown>, |
| 501 | snakeKey: string, |
| 502 | value: Record<string, T> | undefined, |
| 503 | toToml: (v: T, raw: unknown) => Record<string, unknown>, |
| 504 | ): void { |
| 505 | if (value === undefined) { |
| 506 | delete out[snakeKey]; |
| 507 | return; |
| 508 | } |
| 509 | |
| 510 | const rawSub = cloneRecord(out[snakeKey]); |
| 511 | const converted: Record<string, unknown> = {}; |
| 512 | for (const [entryName, entryConfig] of Object.entries(value)) { |
| 513 | converted[entryName] = toToml(entryConfig, rawSub[entryName]); |
| 514 | } |
| 515 | |
| 516 | if (Object.keys(converted).length > 0) { |
| 517 | out[snakeKey] = converted; |
| 518 | } else { |
| 519 | delete out[snakeKey]; |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | function setSection<T>( |
| 524 | out: Record<string, unknown>, |
no test coverage detected