1 var baseClone = require('./internal/baseClone');
4 * This method is like `_.clone` except that it accepts `customizer` which
5 * is invoked to produce the cloned value. If `customizer` returns `undefined`
6 * cloning is handled by the method instead. The `customizer` is invoked with
7 * up to four arguments; (value [, index|key, object, stack]).
12 * @param {*} value The value to clone.
13 * @param {Function} [customizer] The function to customize cloning.
14 * @returns {*} Returns the cloned value.
17 * function customizer(value) {
18 * if (_.isElement(value)) {
19 * return value.cloneNode(false);
23 * var el = _.cloneWith(document.body, customizer);
25 * console.log(el === document.body);
27 * console.log(el.nodeName);
29 * console.log(el.childNodes.length);
32 function cloneWith(value, customizer) {
33 return baseClone(value, false, customizer);
36 module.exports = cloneWith;