MCPcopy
hub / github.com/monkeytypegame/monkeytype / mergeWithDefaultConfig

Function mergeWithDefaultConfig

frontend/src/ts/config/utils.ts:21–30  ·  view source on GitHub ↗
(config: PartialConfig)

Source from the content-addressed store, hash-verified

19}
20
21function mergeWithDefaultConfig(config: PartialConfig): ConfigSchema {
22 const defaultConfig = getDefaultConfig();
23 const mergedConfig = {} as ConfigSchema;
24 for (const key of typedKeys(defaultConfig)) {
25 const newValue = config[key] ?? (defaultConfig[key] as ConfigValue);
26 //@ts-expect-error cant be bothered to deal with this
27 mergedConfig[key] = newValue;
28 }
29 return mergedConfig;
30}
31
32/**
33 * remove all values from the config which are not valid

Callers 1

migrateConfigFunction · 0.85

Calls 2

getDefaultConfigFunction · 0.90
typedKeysFunction · 0.90

Tested by

no test coverage detected