b4177e6ab9372ef802f29ea2b07b7fc9c7a36a05
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / assignIn.js
1 var copyObject = require('./_copyObject'),
2     createAssigner = require('./_createAssigner'),
3     keysIn = require('./keysIn');
4
5 /**
6  * This method is like `_.assign` except that it iterates over own and
7  * inherited source properties.
8  *
9  * **Note:** This method mutates `object`.
10  *
11  * @static
12  * @memberOf _
13  * @alias extend
14  * @category Object
15  * @param {Object} object The destination object.
16  * @param {...Object} [sources] The source objects.
17  * @returns {Object} Returns `object`.
18  * @example
19  *
20  * function Foo() {
21  *   this.b = 2;
22  * }
23  *
24  * function Bar() {
25  *   this.d = 4;
26  * }
27  *
28  * Foo.prototype.c = 3;
29  * Bar.prototype.e = 5;
30  *
31  * _.assignIn({ 'a': 1 }, new Foo, new Bar);
32  * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
33  */
34 var assignIn = createAssigner(function(object, source) {
35   copyObject(source, keysIn(source), object);
36 });
37
38 module.exports = assignIn;