source: imaps-frontend/node_modules/lodash-es/assignInWith.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import copyObject from './_copyObject.js';
2import createAssigner from './_createAssigner.js';
3import keysIn from './keysIn.js';
4
5/**
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).
10 *
11 * **Note:** This method mutates `object`.
12 *
13 * @static
14 * @memberOf _
15 * @since 4.0.0
16 * @alias extendWith
17 * @category 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`.
22 * @see _.assignWith
23 * @example
24 *
25 * function customizer(objValue, srcValue) {
26 * return _.isUndefined(objValue) ? srcValue : objValue;
27 * }
28 *
29 * var defaults = _.partialRight(_.assignInWith, customizer);
30 *
31 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
32 * // => { 'a': 1, 'b': 2 }
33 */
34var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
35 copyObject(source, keysIn(source), object, customizer);
36});
37
38export default assignInWith;
Note: See TracBrowser for help on using the repository browser.