The value to recursively clone.
The function to customize cloning.
Rest
...any: 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
This method is like
cloneWith
except that it recursively clonesvalue
. The customizer is invoked with up to four arguments (value [, index|key, object, stack]).