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

Unified Diff: ui/webui/resources/js/assert.js

Issue 418663002: Typecheck JS files for chrome://help before doing import transition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@json_to_pydict
Patch Set: Yet last fixes Created 6 years, 5 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
Index: ui/webui/resources/js/assert.js
diff --git a/ui/webui/resources/js/assert.js b/ui/webui/resources/js/assert.js
index 800a4c25163d5f01f7fdc78c26e0d2826e11edb1..10792fb2f360f36a89c2983538bc7258ee533370 100644
--- a/ui/webui/resources/js/assert.js
+++ b/ui/webui/resources/js/assert.js
@@ -7,11 +7,13 @@
*/
/**
- * Simple common assertion API
- * @param {*} condition The condition to test. Note that this may be used to
- * test whether a value is defined or not, and we don't want to force a
- * cast to Boolean.
- * @param {string=} opt_message A message to use in any error.
+ * Verify |condition| is truthy and return |condition| if so.
+ * @param {T} condition A condition to check for truthiness. Note that this
+ * may be used to test whether a value is defined or not, and we don't want
+ * to force a cast to Boolean.
+ * @param {string=} opt_message A message to show on failure.
+ * @return {!T} A non-null |condition|.
+ * @template T
Dan Beam 2014/08/06 16:06:59 this didn't work :(
Vitaly Pavlenko 2014/08/07 18:18:13 Reverted.
*/
function assert(condition, opt_message) {
'use strict';
@@ -21,6 +23,7 @@ function assert(condition, opt_message) {
msg = msg + ': ' + opt_message;
throw new Error(msg);
}
+ return condition;
}
/**

Powered by Google App Engine
This is Rietveld 408576698