1 var copyObjectWith = require('./internal/copyObjectWith'),
2 createAssigner = require('./internal/createAssigner'),
3 keysIn = require('./keysIn');
6 * This method is like `_.assignIn` except that it accepts `customizer` which
7 * is invoked to produce the assigned values. If `customizer` returns `undefined`
8 * assignment is handled by the method instead. The `customizer` is invoked
9 * with five arguments: (objValue, srcValue, key, object, source).
11 * **Note:** This method mutates `object`.
17 * @param {Object} object The destination object.
18 * @param {...Object} sources The source objects.
19 * @param {Function} [customizer] The function to customize assigned values.
20 * @returns {Object} Returns `object`.
23 * function customizer(objValue, srcValue) {
24 * return _.isUndefined(objValue) ? srcValue : objValue;
27 * var defaults = _.partialRight(_.assignInWith, customizer);
29 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
30 * // => { 'a': 1, 'b': 2 }
32 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
33 copyObjectWith(source, keysIn(source), object, customizer);
36 module.exports = assignInWith;