UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

27 lines (26 loc) 941 B
/** * This method is like `update` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * **Note:** This method mutates `object`. * * @since 5.3.0 * @category Object * @param object The object to modify. * @param path The path of the property to set. * @param updater The function to produce the updated value. * @param customizer The function to customize assigned values. * @returns Returns `object`. * @example * * ```js * const object = {} * * updateWith(object, '[0][1]', () => 'a', Object) * // => { '0': { '1': 'a' } } * ``` */ export declare function updateWith<T>(object: T, path: Array<string> | string, updater?: (...any: any[]) => any, customizer?: (...any: any[]) => any): T; export default updateWith;