• 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.

    Type Parameters

    • T extends object

    Parameters

    • object: T

      The object to modify.

    • path: PropertyPath

      The path of the property to set.

    • updater: ((oldValue: any) => any)

      The function to produce the updated value.

        • (oldValue): any
        • Parameters

          • oldValue: any

          Returns any

    • Optionalcustomizer: SetWithCustomizer<T>

      The function to customize assigned values.

    Returns T

    Returns object.

    4.6.0

    var object = {};

    _.updateWith(object, '[0][1]', _.constant('a'), Object);
    // => { '0': { '1': 'a' } }
  • Type Parameters

    • T extends object
    • TResult

    Parameters

    • object: T
    • path: PropertyPath
    • updater: ((oldValue: any) => any)
        • (oldValue): any
        • Parameters

          • oldValue: any

          Returns any

    • Optionalcustomizer: SetWithCustomizer<T>

    Returns TResult

    _.updateWith