Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
679 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var baseClone = require('./_baseClone');
|
---|
| 2 |
|
---|
| 3 | /** Used to compose bitmasks for cloning. */
|
---|
| 4 | var CLONE_DEEP_FLAG = 1,
|
---|
| 5 | CLONE_SYMBOLS_FLAG = 4;
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * This method is like `_.clone` except that it recursively clones `value`.
|
---|
| 9 | *
|
---|
| 10 | * @static
|
---|
| 11 | * @memberOf _
|
---|
| 12 | * @since 1.0.0
|
---|
| 13 | * @category Lang
|
---|
| 14 | * @param {*} value The value to recursively clone.
|
---|
| 15 | * @returns {*} Returns the deep cloned value.
|
---|
| 16 | * @see _.clone
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * var objects = [{ 'a': 1 }, { 'b': 2 }];
|
---|
| 20 | *
|
---|
| 21 | * var deep = _.cloneDeep(objects);
|
---|
| 22 | * console.log(deep[0] === objects[0]);
|
---|
| 23 | * // => false
|
---|
| 24 | */
|
---|
| 25 | function cloneDeep(value) {
|
---|
| 26 | return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | module.exports = cloneDeep;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.