Chromium Code Reviews| 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; |
| } |
| /** |