Chromium Code Reviews| Index: remoting/webapp/base/js/base.js |
| diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js |
| index 9257a8603ad4f4746c80d2eb5de6543223f9fde6..f34b2e24ec651557c427b65413744652acaf42f7 100644 |
| --- a/remoting/webapp/base/js/base.js |
| +++ b/remoting/webapp/base/js/base.js |
| @@ -215,6 +215,28 @@ base.deepCopy = function(value) { |
| }; |
| /** |
| + * Returns a copy of the input object with all null/undefined fields |
|
John Williams
2015/04/02 23:57:05
Moved from xhr.js.
|
| + * removed. Returns an empty object for a null/undefined input. |
| + * |
| + * @param {Object<string,?T>|undefined} input |
| + * @return {!Object<string,T>} |
| + * @template T |
| + */ |
| +base.copyWithoutNullFields = function(input) { |
| + /** @const {!Object} */ |
| + var result = {}; |
| + if (input) { |
| + for (var field in input) { |
| + var value = /** @type {*} */ (input[field]); |
| + if (value != null) { |
|
Jamie
2015/04/03 01:45:56
Is "value != null" the same as "value !== null &&
John Williams
2015/04/04 01:40:25
Correct.
|
| + result[field] = value; |
| + } |
| + } |
| + } |
| + return result; |
| +}; |
| + |
| +/** |
| * @type {boolean|undefined} |
| * @private |
| */ |