phaser
Version:
A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.
37 lines (31 loc) • 800 B
JavaScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Clone = 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.
*
* @function Phaser.Utils.Object.Merge
* @since 3.0.0
*
* @param {object} obj1 - [description]
* @param {object} obj2 - [description]
*
* @return {object} [description]
*/
var Merge = function (obj1, obj2)
{
var clone = Clone(obj1);
for (var key in obj2)
{
if (!clone.hasOwnProperty(key))
{
clone[key] = obj2[key];
}
}
return clone;
};
module.exports = Merge;