MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / mergeProfiles

Function mergeProfiles

src/lib/cli-config.ts:102–113  ·  view source on GitHub ↗
(preferred: ProfilesByName, secondary: ProfilesByName)

Source from the content-addressed store, hash-verified

100 * over those in `secondary`.
101 */
102export const mergeProfiles = (preferred: ProfilesByName, secondary: ProfilesByName): ProfilesByName => {
103 const mergeInto = (into: ProfilesByName, from: ProfilesByName): ProfilesByName => {
104 for (const [profileName, profileData] of Object.entries(from)) {
105 if (!(profileName in into)) {
106 into[profileName] = {}
107 }
108 Object.assign(into[profileName], profileData)
109 }
110 return into
111 }
112 return mergeInto(mergeInto({}, secondary), preferred)
113}
114
115export const loadConfig = async (description: CLIConfigDescription, logger: Logger): Promise<CLIConfig> => {
116 const config = await loadConfigFile(description.configFilename)

Callers 6

loadConfigFunction · 0.85
setConfigKeyFunction · 0.85
resetManagedConfigKeyFunction · 0.85
resetManagedConfigFunction · 0.85
cli-config.test.tsFile · 0.85
makeConfigFunction · 0.85

Calls 1

mergeIntoFunction · 0.85

Tested by 1

makeConfigFunction · 0.68