UNPKG

arcade-physics

Version:
38 lines 1.28 kB
"use strict"; /* eslint-disable no-prototype-builtins */ /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Clone_1 = __importDefault(require("./Clone")); /** * Creates a new Object using all values from obj1 and obj2. * If a value exists in both obj1 and obj2, the value in obj1 is used. * * This is only a shallow copy. Deeply nested objects are not cloned, so be sure to only use this * function on shallow objects. * * @function Phaser.Utils.Objects.Merge * @since 3.0.0 * * @param {object} obj1 - The first object. * @param {object} obj2 - The second object. * * @return {object} A new object containing the union of obj1's and obj2's properties. */ const Merge = (obj1, obj2) => { const clone = (0, Clone_1.default)(obj1); for (const key in obj2) { if (!clone.hasOwnProperty(key)) { clone[key] = obj2[key]; } } return clone; }; exports.default = Merge; //# sourceMappingURL=Merge.js.map