basant307/AI_Governance_Project
045
1import baseUpdate from './_baseUpdate.js';2import castFunction from './_castFunction.js';3 4/**5 * This method is like `_.update` except that it accepts `customizer` which is6 * invoked to produce the objects of `path`. If `customizer` returns `undefined`7 * path creation is handled by the method instead. The `customizer` is invoked8 * with three arguments: (nsValue, key, nsObject).9 *10 * **Note:** This method mutates `object`.11 *12 * @static13 * @memberOf _14 * @since 4.6.015 * @category Object16 * @param {Object} object The object to modify.17 * @param {Array|string} path The path of the property to set.18 * @param {Function} updater The function to produce the updated value.19 * @param {Function} [customizer] The function to customize assigned values.20 * @returns {Object} Returns `object`.21 * @example22 *23 * var object = {};24 *25 * _.updateWith(object, '[0][1]', _.constant('a'), Object);26 * // => { '0': { '1': 'a' } }27 */28function updateWith(object, path, updater, customizer) {29 customizer = typeof customizer == 'function' ? customizer : undefined;30 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);31}32 33export default updateWith;34 