UNPKG

arcade-physics

Version:
36 lines 1.31 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. * * Then scans obj2. If a property is found in obj2 that *also* exists in obj1, the value from obj2 is used, otherwise the property is skipped. * * @function Phaser.Utils.Objects.MergeRight * @since 3.0.0 * * @param {object} obj1 - The first object to merge. * @param {object} obj2 - The second object to merge. Keys from this object which also exist in `obj1` will be copied to `obj1`. * * @return {object} The merged object. `obj1` and `obj2` are not modified. */ const MergeRight = (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 = MergeRight; //# sourceMappingURL=MergeRight.js.map