source: trip-planner-front/node_modules/lodash/assignWith.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[6a3a178]1var copyObject = require('./_copyObject'),
2 createAssigner = require('./_createAssigner'),
3 keys = require('./keys');
4
5/**
6 * This method is like `_.assign` 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 * @category 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`.
21 * @see _.assignInWith
22 * @example
23 *
24 * function customizer(objValue, srcValue) {
25 * return _.isUndefined(objValue) ? srcValue : objValue;
26 * }
27 *
28 * var defaults = _.partialRight(_.assignWith, customizer);
29 *
30 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
31 * // => { 'a': 1, 'b': 2 }
32 */
33var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
34 copyObject(source, keys(source), object, customizer);
35});
36
37module.exports = assignWith;
Note: See TracBrowser for help on using the repository browser.