MCPcopy
hub / github.com/fanmingming/live / mergeData

Function mergeData

m3u8/vue.js:1181–1206  ·  view source on GitHub ↗

* Helper that recursively merges two data objects together.

(to, from)

Source from the content-addressed store, hash-verified

1179 * Helper that recursively merges two data objects together.
1180 */
1181 function mergeData (to, from) {
1182 if (!from) { return to }
1183 var key, toVal, fromVal;
1184
1185 var keys = hasSymbol
1186 ? Reflect.ownKeys(from)
1187 : Object.keys(from);
1188
1189 for (var i = 0; i < keys.length; i++) {
1190 key = keys[i];
1191 // in case the object is already observed...
1192 if (key === '__ob__') { continue }
1193 toVal = to[key];
1194 fromVal = from[key];
1195 if (!hasOwn(to, key)) {
1196 set(to, key, fromVal);
1197 } else if (
1198 toVal !== fromVal &&
1199 isPlainObject(toVal) &&
1200 isPlainObject(fromVal)
1201 ) {
1202 mergeData(toVal, fromVal);
1203 }
1204 }
1205 return to
1206 }
1207
1208 /**
1209 * Data

Callers 1

mergeDataOrFnFunction · 0.85

Calls 3

hasOwnFunction · 0.85
setFunction · 0.85
isPlainObjectFunction · 0.85

Tested by

no test coverage detected