here:
What is the most efficient way to deep clone an object in JavaScript?
Obviously there are many ways to do it, but I wanted to use the 2nd best answer from this post as it does not use jQuery.
Here is my first try. If this is better for code review please migrate, but it is such a small method.
Pub.cloneDeep = function (obj) {
_.each(nativeSlice.call(arguments, 1), function (val) {
_.each(val, function (val_inner, key) {
obj[key] = JSON.parse(JSON.stringify(val_inner));
});
});
return obj;
};