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

    Parameters

    • value: any

      The value to recursively clone.

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

      The function to customize cloning.

        • (...any): any
        • Parameters

          • Rest...any: any[]

          Returns any

    Returns any

    Returns the deep cloned value.

    5.3.0

    cloneWith

    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