Options
All
  • Public
  • Public/Protected
  • All
Menu

Module cloneDeepWith

Index

Functions Lang

Lang Functions

  • default(value: any, customizer: (...any: any[]) => any): any
  • This method is like cloneWith except that it recursively clones value. The customizer is invoked with up to four arguments (value [, index|key, object, stack]).

    since

    5.3.0

    see

    cloneWith

    example
    function customizer(value) {
    if (isElement(value)) {
    return value.cloneNode(true)
    }
    }

    const el = cloneDeepWith(document.body, customizer)

    console.log(el === document.body)
    // => false
    console.log(el.nodeName)
    // => 'BODY'
    console.log(el.childNodes.length)
    // => 20

    Parameters

    • value: any

      The value to recursively clone.

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

      The function to customize cloning.

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

          • Rest ...any: any[]

          Returns any

    Returns any

    Returns the deep cloned value.