Sha256: 491bdda5557abdff9d83132e37fae0f98bd3c94f5ff66ce547be1c7f6371358c

Contents?: true

Size: 1.75 KB

Versions: 153

Compression:

Stored size: 1.75 KB

Contents

var baseClone = require('../internal/baseClone'),
    bindCallback = require('../internal/bindCallback');

/**
 * Creates a deep clone of `value`. If `customizer` is provided it's invoked
 * to produce the cloned values. If `customizer` returns `undefined` cloning
 * is handled by the method instead. The `customizer` is bound to `thisArg`
 * and invoked with up to three argument; (value [, index|key, object]).
 *
 * **Note:** This method is loosely based on the
 * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
 * The enumerable properties of `arguments` objects and objects created by
 * constructors other than `Object` are cloned to plain `Object` objects. An
 * empty object is returned for uncloneable values such as functions, DOM nodes,
 * Maps, Sets, and WeakMaps.
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to deep clone.
 * @param {Function} [customizer] The function to customize cloning values.
 * @param {*} [thisArg] The `this` binding of `customizer`.
 * @returns {*} Returns the deep cloned value.
 * @example
 *
 * var users = [
 *   { 'user': 'barney' },
 *   { 'user': 'fred' }
 * ];
 *
 * var deep = _.cloneDeep(users);
 * deep[0] === users[0];
 * // => false
 *
 * // using a customizer callback
 * var el = _.cloneDeep(document.body, function(value) {
 *   if (_.isElement(value)) {
 *     return value.cloneNode(true);
 *   }
 * });
 *
 * el === document.body
 * // => false
 * el.nodeName
 * // => BODY
 * el.childNodes.length;
 * // => 20
 */
function cloneDeep(value, customizer, thisArg) {
  return typeof customizer == 'function'
    ? baseClone(value, true, bindCallback(customizer, thisArg, 3))
    : baseClone(value, true);
}

module.exports = cloneDeep;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
trusty-festivity-extension-2.3.30 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.29 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.29 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.28 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.28 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.27 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.27 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.26 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.26 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.25 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.25 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.24 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.24 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.23 node_modules/bower/node_modules/inquirer/node_modules/lodash/lang/cloneDeep.js
trusty-festivity-extension-2.3.23 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/lang/cloneDeep.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/lodash/lang/cloneDeep.js
es6_tilt-0.1.2 test/dummy/node_modules/lodash/lang/cloneDeep.js
es6_tilt-0.1.1 test/dummy/node_modules/lodash/lang/cloneDeep.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/lodash/lang/cloneDeep.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/lodash/lang/cloneDeep.js