Index: remoting/webapp/base/js/base.js |
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js |
index 86c91565bb9f1907eaa792dbafeb4dcb5f0e187f..11bd091acf0ca9d5397e91db878a399403450da9 100644 |
--- a/remoting/webapp/base/js/base.js |
+++ b/remoting/webapp/base/js/base.js |
@@ -112,6 +112,18 @@ base.values = function(dict) { |
}; |
/** |
+ * @param {*} value |
+ * @return {*} a recursive copy of |value| or null if |value| is not copyable |
+ * (e.g. undefined, NaN). |
+ */ |
+base.deepCopy = function (value) { |
+ try { |
+ return JSON.parse(JSON.stringify(value)); |
+ } catch (e) {} |
+ return null; |
+}; |
+ |
+/** |
* @type {boolean|undefined} |
* @private |
*/ |