forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMergeRight.js
More file actions
37 lines (32 loc) · 882 Bytes
/
Copy pathMergeRight.js
File metadata and controls
37 lines (32 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @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.
*
* 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 - [description]
* @param {object} obj2 - [description]
*
* @return {object} [description]
*/
var MergeRight = function (obj1, obj2)
{
var clone = Clone(obj1);
for (var key in obj2)
{
if (clone.hasOwnProperty(key))
{
clone[key] = obj2[key];
}
}
return clone;
};
module.exports = MergeRight;