You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							41 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
	
	
							41 lines
						
					
					
						
							1.0 KiB
						
					
					
				var baseClone = require('./_baseClone');
 | 
						|
 | 
						|
/** Used to compose bitmasks for cloning. */
 | 
						|
var CLONE_DEEP_FLAG = 1,
 | 
						|
    CLONE_SYMBOLS_FLAG = 4;
 | 
						|
 | 
						|
/**
 | 
						|
 * This method is like `_.cloneWith` except that it recursively clones `value`.
 | 
						|
 *
 | 
						|
 * @static
 | 
						|
 * @memberOf _
 | 
						|
 * @since 4.0.0
 | 
						|
 * @category Lang
 | 
						|
 * @param {*} value The value to recursively clone.
 | 
						|
 * @param {Function} [customizer] The function to customize cloning.
 | 
						|
 * @returns {*} Returns the deep cloned value.
 | 
						|
 * @see _.cloneWith
 | 
						|
 * @example
 | 
						|
 *
 | 
						|
 * function customizer(value) {
 | 
						|
 *   if (_.isElement(value)) {
 | 
						|
 *     return value.cloneNode(true);
 | 
						|
 *   }
 | 
						|
 * }
 | 
						|
 *
 | 
						|
 * var el = _.cloneDeepWith(document.body, customizer);
 | 
						|
 *
 | 
						|
 * console.log(el === document.body);
 | 
						|
 * // => false
 | 
						|
 * console.log(el.nodeName);
 | 
						|
 * // => 'BODY'
 | 
						|
 * console.log(el.childNodes.length);
 | 
						|
 * // => 20
 | 
						|
 */
 | 
						|
function cloneDeepWith(value, customizer) {
 | 
						|
  customizer = typeof customizer == 'function' ? customizer : undefined;
 | 
						|
  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
 | 
						|
}
 | 
						|
 | 
						|
module.exports = cloneDeepWith;
 |