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

defaultsDeep.js 839B

123456789101112131415161718192021222324252627282930
  1. var apply = require('./_apply'),
  2. baseRest = require('./_baseRest'),
  3. customDefaultsMerge = require('./_customDefaultsMerge'),
  4. mergeWith = require('./mergeWith');
  5. /**
  6. * This method is like `_.defaults` except that it recursively assigns
  7. * default properties.
  8. *
  9. * **Note:** This method mutates `object`.
  10. *
  11. * @static
  12. * @memberOf _
  13. * @since 3.10.0
  14. * @category Object
  15. * @param {Object} object The destination object.
  16. * @param {...Object} [sources] The source objects.
  17. * @returns {Object} Returns `object`.
  18. * @see _.defaults
  19. * @example
  20. *
  21. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  22. * // => { 'a': { 'b': 2, 'c': 3 } }
  23. */
  24. var defaultsDeep = baseRest(function(args) {
  25. args.push(undefined, customDefaultsMerge);
  26. return apply(mergeWith, undefined, args);
  27. });
  28. module.exports = defaultsDeep;