mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v4.0.0.
This commit is contained in:
33
cloneDeepWith.js
Normal file
33
cloneDeepWith.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import baseClone from './internal/baseClone';
|
||||
|
||||
/**
|
||||
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to recursively clone.
|
||||
* @param {Function} [customizer] The function to customize cloning.
|
||||
* @returns {*} Returns the deep cloned value.
|
||||
* @example
|
||||
*
|
||||
* function customizer(value) {
|
||||
* if (_.isElement(value)) {
|
||||
* return value.cloneNode(true);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* var el = _.cloneDeep(document.body, customizer);
|
||||
*
|
||||
* console.log(el === document.body);
|
||||
* // => false
|
||||
* console.log(el.nodeName);
|
||||
* // => 'BODY'
|
||||
* console.log(el.childNodes.length);
|
||||
* // => 20
|
||||
*/
|
||||
function cloneDeepWith(value, customizer) {
|
||||
return baseClone(value, true, customizer);
|
||||
}
|
||||
|
||||
export default cloneDeepWith;
|
||||
Reference in New Issue
Block a user