| Function Summary | |
assert(<Any Type> condition, string= opt_message, <Any Type> var_args) ⇒ <Any Type>Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is true. | |
assertArray(<Any Type> value, string= opt_message, <Any Type> var_args) ⇒ !ArrayChecks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true. | |
assertBoolean(<Any Type> value, string= opt_message, <Any Type> var_args) ⇒ booleanChecks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true. | |
assertFunction(<Any Type> value, string= opt_message, <Any Type> var_args) ⇒ !FunctionChecks if the value is a function if goog.asserts.ENABLE_ASSERTS is true. | |
assertInstanceof(<Any Type> value, !Function type, string= opt_message, <Any Type> var_args)Checks if the value is an instance of the user-defined type if goog.asserts.ENABLE_ASSERTS is true. | |
assertNumber(<Any Type> value, string= opt_message, <Any Type> var_args) ⇒ numberChecks if the value is a number if goog.asserts.ENABLE_ASSERTS is true. | |
assertObject(<Any Type> value, string= opt_message, <Any Type> var_args) ⇒ !ObjectChecks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true. | |
assertString(<Any Type> value, string= opt_message, <Any Type> var_args) ⇒ stringChecks if the value is a string if goog.asserts.ENABLE_ASSERTS is true. | |
doAssertFailure_(string defaultMessage, ?Array defaultArgs, (string|undefined) givenMessage, ?Array givenArgs)Throws an exception with the given message and "Assertion failed" prefixed onto it. | |
fail(string= opt_message, <Any Type> var_args)Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case when we want to add a check in the unreachable area like switch-case statement:
switch(type) {
case FOO: doSomething(); break;
case BAR: doSomethingElse(); break;
default: goog.assert.fail('Unrecognized type: ' + type);
// We have only 2 types - "default:" section is unreachable code.
}
| |