Every line of 'angular merge objects' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
158 function mergeObject(dst, src) { 159 Object.keys(src).forEach(function(key) { 160 dst[key] = src[key]; 161 }); 162 163 return dst; 164 }
29 export function mergeObject(from, to, force, shallow) { 30 if (shallow && isUndef(to)) { 31 return from; 32 } 33 34 to = to || {}; 35 36 if (isArray(from)) { 37 if (!isArray(to) && force) { 38 to = []; 39 } 40 if (isArray(to)) { 41 from.forEach((item, index) => { 42 to[index] = mergeObject(item, to[index], force, shallow); 43 }); 44 } 45 } else if (from) { 46 if (!isPlainObj(from)) { 47 if (force) { 48 to = from; 49 } 50 } else { 51 for (var key in from) { 52 if (typeof from[key] === 'object') { 53 if (isUndef(to[key])) { 54 to[key] = deepCopy(from[key], to[key], shallow); 55 } else { 56 mergeObject(from[key], to[key], force, shallow); 57 } 58 } else { 59 if (isUndef(to[key]) || force) to[key] = from[key]; 60 } 61 } 62 } 63 } 64 65 return to; 66 }
14 function merge(objA, objB) { 15 return Object.assign({}, objA, objB); 16 }
55 function deepExtend(destination, source) { 56 for (var property in source) { 57 if (source[property] && source[property].constructor && source[property].constructor === Object) { 58 destination[property] = destination[property] || {}; 59 deepExtend(destination[property], source[property]); 60 } else { 61 destination[property] = source[property]; 62 } 63 } 64 return destination; 65 }
13 static merge(dest: Object, src: Object): Object { 14 if (ObjectUtil.isBlank(src)) { 15 return dest; 16 } 17 if (ObjectUtil.isBlank(dest)) { 18 return src; 19 } 20 for (let prop in src) { 21 if (src.hasOwnProperty(prop)) { 22 dest[prop] = src[prop]; 23 } 24 } 25 return dest; 26 }
102 function deepMerge(a, b) { 103 return compose({[prop]: a}, {[prop]: b}).compose[prop]; 104 }
22 function mergeData (to, from) { 23 var key, toVal, fromVal 24 for (key in from) { 25 toVal = to[key] 26 fromVal = from[key] 27 if (!to.hasOwnProperty(key)) { 28 to.$add(key, fromVal) 29 } else if (_.isObject(toVal) && _.isObject(fromVal)) { 30 mergeData(toVal, fromVal) 31 } 32 } 33 return to 34 }
719 function mergeObject(source) { 720 var target = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 721 722 var keys = Object.keys(source); 723 var _iteratorNormalCompletion2 = true; 724 var _didIteratorError2 = false; 725 var _iteratorError2 = undefined; 726 727 try { 728 for (var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { 729 var key = _step2.value; 730 731 var newData = source[key]; 732 var curData = target[key]; 733 734 if (isObject(curData) && isObject(newData)) { 735 mergeObject(newData, curData); 736 } else { 737 target[key] = newData; 738 } 739 } 740 } catch (err) { 741 _didIteratorError2 = true; 742 _iteratorError2 = err; 743 } finally { 744 try { 745 if (!_iteratorNormalCompletion2 && _iterator2.return) { 746 _iterator2.return(); 747 } 748 } finally { 749 if (_didIteratorError2) { 750 throw _iteratorError2; 751 } 752 } 753 } 754 755 return target; 756 }
54 function mergeObject(target, source, options) { 55 var destination = {} 56 if (options.isMergeableObject(target)) { 57 getKeys(target).forEach(function(key) { 58 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options) 59 }) 60 } 61 getKeys(source).forEach(function(key) { 62 if (propertyIsUnsafe(target, key)) { 63 return 64 } 65 66 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 67 destination[key] = getMergeFunction(key, options)(target[key], source[key], options) 68 } else { 69 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) 70 } 71 }) 72 return destination 73 }
99 function objMerge(a, b) { 100 Object.keys(b).forEach(function (k) { 101 a[k] = b[k]; 102 }); 103 return a; 104 }