Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

_customDefaultsMerge.js 1.0KB

12345678910111213141516171819202122232425262728
  1. var baseMerge = require('./_baseMerge'),
  2. isObject = require('./isObject');
  3. /**
  4. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  5. * objects into destination objects that are passed thru.
  6. *
  7. * @private
  8. * @param {*} objValue The destination value.
  9. * @param {*} srcValue The source value.
  10. * @param {string} key The key of the property to merge.
  11. * @param {Object} object The parent object of `objValue`.
  12. * @param {Object} source The parent object of `srcValue`.
  13. * @param {Object} [stack] Tracks traversed source values and their merged
  14. * counterparts.
  15. * @returns {*} Returns the value to assign.
  16. */
  17. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  18. if (isObject(objValue) && isObject(srcValue)) {
  19. // Recursively merge objects and arrays (susceptible to call stack limits).
  20. stack.set(srcValue, objValue);
  21. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22. stack['delete'](srcValue);
  23. }
  24. return objValue;
  25. }
  26. module.exports = customDefaultsMerge;