_baseUpdate.js 605 B

12345678910111213141516171819
  1. var baseGet = require('./_baseGet'),
  2. baseSet = require('./_baseSet');
  3. /**
  4. * The base implementation of `_.update`.
  5. *
  6. * @private
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to update.
  9. * @param {Function} updater The function to produce the updated value.
  10. * @param {Function} [customizer] The function to customize path creation.
  11. * @returns {Object} Returns `object`.
  12. */
  13. function baseUpdate(object, path, updater, customizer) {
  14. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  15. }
  16. module.exports = baseUpdate;