cloneDeep source npm

_.cloneDeep(value)

This method is like _.clone except that it recursively clones value.

Arguments

  1. value (*)

    The value to recursively clone.

Returns (*)

Returns the deep cloned value.

Example

var users = [
  { 'user': 'barney' },
  { 'user': 'fred' }
];

var deep = _.cloneDeep(users);
console.log(deep[0] === users[0]);
// => false