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