Options
All
  • Public
  • Public/Protected
  • All
Menu

Module updateWith

Index

References

Functions Object

References

Renames and re-exports updateWith

Object Functions

  • updateWith<T>(object: T, path: string | string[], updater?: (...any: any[]) => any, customizer?: (...any: any[]) => any): T
  • 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

    example
    const object = {}

    updateWith(object, '[0][1]', () => 'a', Object)
    // => { '0': { '1': 'a' } }

    Type parameters

    • T

    Parameters

    • object: T

      The object to modify.

    • path: string | string[]

      The path of the property to set.

    • Optional updater: (...any: any[]) => any

      The function to produce the updated value.

        • (...any: any[]): any
        • Parameters

          • Rest ...any: any[]

          Returns any

    • Optional customizer: (...any: any[]) => any

      The function to customize assigned values.

        • (...any: any[]): any
        • Parameters

          • Rest ...any: any[]

          Returns any

    Returns T

    Returns object.