UI for Zipcoin Blue

mergeWith.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var baseMerge = require('./_baseMerge'),
  2. createAssigner = require('./_createAssigner');
  3. /**
  4. * This method is like `_.merge` except that it accepts `customizer` which
  5. * is invoked to produce the merged values of the destination and source
  6. * properties. If `customizer` returns `undefined`, merging is handled by the
  7. * method instead. The `customizer` is invoked with six arguments:
  8. * (objValue, srcValue, key, object, source, stack).
  9. *
  10. * **Note:** This method mutates `object`.
  11. *
  12. * @static
  13. * @memberOf _
  14. * @since 4.0.0
  15. * @category Object
  16. * @param {Object} object The destination object.
  17. * @param {...Object} sources The source objects.
  18. * @param {Function} customizer The function to customize assigned values.
  19. * @returns {Object} Returns `object`.
  20. * @example
  21. *
  22. * function customizer(objValue, srcValue) {
  23. * if (_.isArray(objValue)) {
  24. * return objValue.concat(srcValue);
  25. * }
  26. * }
  27. *
  28. * var object = { 'a': [1], 'b': [2] };
  29. * var other = { 'a': [3], 'b': [4] };
  30. *
  31. * _.mergeWith(object, other, customizer);
  32. * // => { 'a': [1, 3], 'b': [2, 4] }
  33. */
  34. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  35. baseMerge(object, source, srcIndex, customizer);
  36. });
  37. module.exports = mergeWith;