Index: remoting/webapp/base/js/typecheck.js |
diff --git a/remoting/webapp/base/js/typecheck.js b/remoting/webapp/base/js/typecheck.js |
index 10e1959dd7b33fec2055708c5b0f5329eb0c5a03..17b16a6f5456e85cfb9a5967f967e5c8bacf88c8 100644 |
--- a/remoting/webapp/base/js/typecheck.js |
+++ b/remoting/webapp/base/js/typecheck.js |
@@ -19,17 +19,25 @@ var isArray = function(value) { |
/** |
* @param {*} value |
+ * @param {boolean=} opt_allowUndefined True to accept undefined. |
* @return {boolean} |
*/ |
-var isBoolean = function(value) { |
+var isBoolean = function(value, opt_allowUndefined) { |
+ if (opt_allowUndefined && value === 'undefined') { |
+ return true; |
+ } |
return typeof value == 'boolean'; |
}; |
/** |
* @param {*} value |
+ * @param {boolean=} opt_allowUndefined True to accept undefined. |
* @return {boolean} |
*/ |
-var isNumber = function(value) { |
+var isNumber = function(value, opt_allowUndefined) { |
+ if (opt_allowUndefined && value === 'undefined') { |
+ return true; |
+ } |
return typeof value == 'number'; |
}; |
@@ -43,9 +51,13 @@ var isObject = function(value) { |
/** |
* @param {*} value |
+ * @param {boolean=} opt_allowUndefined True to accept undefined. |
* @return {boolean} |
*/ |
-var isString = function(value) { |
+var isString = function(value, opt_allowUndefined) { |
+ if (opt_allowUndefined && value === 'undefined') { |
+ return true; |
+ } |
return typeof value == 'string'; |
}; |
@@ -246,4 +258,4 @@ base.getJsonObjectFromString = function(jsonString) { |
return base.assertObject(base.jsonParseSafe(jsonString)); |
}; |
-})(); |
+})(); |