Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: remoting/webapp/base/js/base.js

Issue 1358173005: Refactor HostSettings class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/base/js/base_unittest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/base.js
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index 602d12915ca8e2ebf21b34db21abf66fb375156a..f8c7cc7b3f03603ce8dca4ef2379c3b7ddee8dd4 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -188,17 +188,27 @@ base.deepCopy = function(value) {
* @template T
*/
base.copyWithoutNullFields = function(input) {
- /** @const {!Object} */
var result = {};
- if (input) {
- for (var field in input) {
- var value = /** @type {*} */ (input[field]);
+ base.mergeWithoutNullFields(result, input);
+ return result;
+};
+
+/**
+ * Merge non-null fields of |src| into |dest|.
+ *
+ * @param {!Object<T>} dest
+ * @param {Object<?T>|undefined} src
+ * @template T
+ */
+base.mergeWithoutNullFields = function(dest, src) {
+ if (src) {
+ for (var field in src) {
+ var value = /** @type {*} */ (src[field]);
if (value != null) {
- result[field] = value;
+ dest[field] = base.deepCopy(value);
}
}
}
- return result;
};
/**
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/base/js/base_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698