MCPcopy Create free account
hub / github.com/microsoft/SandDance / mergeObject

Function mergeObject

docs/app/js/sanddance-app.js:6918–6928  ·  view source on GitHub ↗
(target, source, options)

Source from the content-addressed store, hash-verified

6916 });
6917}
6918function mergeObject(target, source, options) {
6919 var destination = {};
6920 if (options.isMergeableObject(target)) Object.keys(target).forEach(function(key) {
6921 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
6922 });
6923 Object.keys(source).forEach(function(key) {
6924 if (!options.isMergeableObject(source[key]) || !target[key]) destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
6925 else destination[key] = deepmerge(target[key], source[key], options);
6926 });
6927 return destination;
6928}
6929function deepmerge(target, source, options) {
6930 options = options || {};
6931 options.arrayMerge = options.arrayMerge || defaultArrayMerge;

Callers 1

deepmergeFunction · 0.70

Calls 3

deepmergeFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected