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

Function mergeInto

src/lib/cli-config.ts:103–111  ·  view source on GitHub ↗
(into: ProfilesByName, from: ProfilesByName)

Source from the content-addressed store, hash-verified

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

Callers 1

mergeProfilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected