@newdash/newdash
Version:
javascript/typescript utility library
33 lines (32 loc) • 845 B
TypeScript
/**
* 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
* @category Lang
* @param value The value to recursively clone.
* @param customizer The function to customize cloning.
* @returns Returns the deep cloned value.
* @see cloneWith
* @example
*
* ```js
* 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
* ```
*/
declare function cloneDeepWith(value: any, customizer: (...any: any[]) => any): any;
export default cloneDeepWith;