mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
30 lines
677 B
JavaScript
30 lines
677 B
JavaScript
|
import baseClone from './_baseClone.js';
|
||
|
|
||
|
/** Used to compose bitmasks for cloning. */
|
||
|
var CLONE_DEEP_FLAG = 1,
|
||
|
CLONE_SYMBOLS_FLAG = 4;
|
||
|
|
||
|
/**
|
||
|
* This method is like `_.clone` except that it recursively clones `value`.
|
||
|
*
|
||
|
* @static
|
||
|
* @memberOf _
|
||
|
* @since 1.0.0
|
||
|
* @category Lang
|
||
|
* @param {*} value The value to recursively clone.
|
||
|
* @returns {*} Returns the deep cloned value.
|
||
|
* @see _.clone
|
||
|
* @example
|
||
|
*
|
||
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
||
|
*
|
||
|
* var deep = _.cloneDeep(objects);
|
||
|
* console.log(deep[0] === objects[0]);
|
||
|
* // => false
|
||
|
*/
|
||
|
function cloneDeep(value) {
|
||
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
||
|
}
|
||
|
|
||
|
export default cloneDeep;
|