UNPKG

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