Initial commit
[yaffs-website] / node_modules / node-sass / node_modules / lodash / cloneWith.js
1 var baseClone = require('./_baseClone');
2
3 /**
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]).
8  *
9  * @static
10  * @memberOf _
11  * @since 4.0.0
12  * @category Lang
13  * @param {*} value The value to clone.
14  * @param {Function} [customizer] The function to customize cloning.
15  * @returns {*} Returns the cloned value.
16  * @see _.cloneDeepWith
17  * @example
18  *
19  * function customizer(value) {
20  *   if (_.isElement(value)) {
21  *     return value.cloneNode(false);
22  *   }
23  * }
24  *
25  * var el = _.cloneWith(document.body, customizer);
26  *
27  * console.log(el === document.body);
28  * // => false
29  * console.log(el.nodeName);
30  * // => 'BODY'
31  * console.log(el.childNodes.length);
32  * // => 0
33  */
34 function cloneWith(value, customizer) {
35   customizer = typeof customizer == 'function' ? customizer : undefined;
36   return baseClone(value, false, true, customizer);
37 }
38
39 module.exports = cloneWith;