Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / globule / node_modules / lodash / merge.js
1 var baseMerge = require('./_baseMerge'),
2     createAssigner = require('./_createAssigner');
3
4 /**
5  * This method is like `_.assign` except that it recursively merges own and
6  * inherited enumerable string keyed properties of source objects into the
7  * destination object. Source properties that resolve to `undefined` are
8  * skipped if a destination value exists. Array and plain object properties
9  * are merged recursively. Other objects and value types are overridden by
10  * assignment. Source objects are applied from left to right. Subsequent
11  * sources overwrite property assignments of previous sources.
12  *
13  * **Note:** This method mutates `object`.
14  *
15  * @static
16  * @memberOf _
17  * @since 0.5.0
18  * @category Object
19  * @param {Object} object The destination object.
20  * @param {...Object} [sources] The source objects.
21  * @returns {Object} Returns `object`.
22  * @example
23  *
24  * var object = {
25  *   'a': [{ 'b': 2 }, { 'd': 4 }]
26  * };
27  *
28  * var other = {
29  *   'a': [{ 'c': 3 }, { 'e': 5 }]
30  * };
31  *
32  * _.merge(object, other);
33  * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
34  */
35 var merge = createAssigner(function(object, source, srcIndex) {
36   baseMerge(object, source, srcIndex);
37 });
38
39 module.exports = merge;