(value: unknown, models: string[])
| 1004 | } |
| 1005 | |
| 1006 | function parseModelDescriptions(value: unknown, models: string[]): Record<string, string> | undefined { |
| 1007 | if (!isObject(value)) { |
| 1008 | return undefined; |
| 1009 | } |
| 1010 | |
| 1011 | const modelIds = new Set(models); |
| 1012 | const entries = Object.entries(value) |
| 1013 | .map(([rawModel, rawDescription]) => [rawModel.trim(), readString(rawDescription)] as const) |
| 1014 | .filter((entry): entry is [string, string] => { |
| 1015 | const [model, description] = entry; |
| 1016 | return Boolean(model && description && modelIds.has(model)); |
| 1017 | }); |
| 1018 | |
| 1019 | return entries.length > 0 ? Object.fromEntries(entries) : undefined; |
| 1020 | } |
| 1021 | |
| 1022 | function parseModelDisplayNames(value: unknown, models: string[]): Record<string, string> | undefined { |
| 1023 | if (!isObject(value)) { |
no test coverage detected
searching dependent graphs…