react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / lang / cloneDeep.js
80742 viewsvar baseClone = require('../internal/baseClone'),1bindCallback = require('../internal/bindCallback');23/**4* Creates a deep clone of `value`. If `customizer` is provided it is invoked5* to produce the cloned values. If `customizer` returns `undefined` cloning6* is handled by the method instead. The `customizer` is bound to `thisArg`7* and invoked with two argument; (value [, index|key, object]).8*9* **Note:** This method is loosely based on the10* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).11* The enumerable properties of `arguments` objects and objects created by12* constructors other than `Object` are cloned to plain `Object` objects. An13* empty object is returned for uncloneable values such as functions, DOM nodes,14* Maps, Sets, and WeakMaps.15*16* @static17* @memberOf _18* @category Lang19* @param {*} value The value to deep clone.20* @param {Function} [customizer] The function to customize cloning values.21* @param {*} [thisArg] The `this` binding of `customizer`.22* @returns {*} Returns the deep cloned value.23* @example24*25* var users = [26* { 'user': 'barney' },27* { 'user': 'fred' }28* ];29*30* var deep = _.cloneDeep(users);31* deep[0] === users[0];32* // => false33*34* // using a customizer callback35* var el = _.cloneDeep(document.body, function(value) {36* if (_.isElement(value)) {37* return value.cloneNode(true);38* }39* });40*41* el === document.body42* // => false43* el.nodeName44* // => BODY45* el.childNodes.length;46* // => 2047*/48function cloneDeep(value, customizer, thisArg) {49return typeof customizer == 'function'50? baseClone(value, true, bindCallback(customizer, thisArg, 1))51: baseClone(value, true);52}5354module.exports = cloneDeep;555657