| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| export function setConfigValue<T extends SettingsConfigType>( |
| config: T, |
| key: string, |
| value: unknown |
| ): void { |
| if (key in config) { |
| (config as Record<string, unknown>)[key] = value; |
| } |
| } |
|
|
| |
| |
| |
| export function getConfigValue<T extends SettingsConfigType>( |
| config: T, |
| key: string |
| ): string | number | boolean | undefined { |
| const value = (config as Record<string, unknown>)[key]; |
| return value as string | number | boolean | undefined; |
| } |
|
|
| |
| |
| |
| |
| export function configToParameterRecord<T extends SettingsConfigType>( |
| config: T, |
| keys: string[] |
| ): Record<string, string | number | boolean> { |
| const record: Record<string, string | number | boolean> = {}; |
|
|
| for (const key of keys) { |
| const value = getConfigValue(config, key); |
| if (value !== undefined) { |
| record[key] = value; |
| } |
| } |
|
|
| return record; |
| } |
|
|