1 line
3.8 KiB
Plaintext
1 line
3.8 KiB
Plaintext
{"version":3,"file":"combine-e9466e32.js","sources":["../../../../Source/Core/combine.js"],"sourcesContent":["import defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\n\n/**\n * Merges two objects, copying their properties onto a new combined object. When two objects have the same\n * property, the value of the property on the first object is used. If either object is undefined,\n * it will be treated as an empty object.\n *\n * @example\n * const object1 = {\n * propOne : 1,\n * propTwo : {\n * value1 : 10\n * }\n * }\n * const object2 = {\n * propTwo : 2\n * }\n * const final = Cesium.combine(object1, object2);\n *\n * // final === {\n * // propOne : 1,\n * // propTwo : {\n * // value1 : 10\n * // }\n * // }\n *\n * @param {Object} [object1] The first object to merge.\n * @param {Object} [object2] The second object to merge.\n * @param {Boolean} [deep=false] Perform a recursive merge.\n * @returns {Object} The combined object containing all properties from both objects.\n *\n * @function\n */\nfunction combine(object1, object2, deep) {\n deep = defaultValue(deep, false);\n\n const result = {};\n\n const object1Defined = defined(object1);\n const object2Defined = defined(object2);\n let property;\n let object1Value;\n let object2Value;\n if (object1Defined) {\n for (property in object1) {\n if (object1.hasOwnProperty(property)) {\n object1Value = object1[property];\n if (\n object2Defined &&\n deep &&\n typeof object1Value === \"object\" &&\n object2.hasOwnProperty(property)\n ) {\n object2Value = object2[property];\n if (typeof object2Value === \"object\") {\n result[property] = combine(object1Value, object2Value, deep);\n } else {\n result[property] = object1Value;\n }\n } else {\n result[property] = object1Value;\n }\n }\n }\n }\n if (object2Defined) {\n for (property in object2) {\n if (\n object2.hasOwnProperty(property) &&\n !result.hasOwnProperty(property)\n ) {\n object2Value = object2[property];\n result[property] = object2Value;\n }\n }\n }\n return result;\n}\nexport default combine;\n"],"names":["defaultValue","defined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAC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