Home > rc-js-util > _Debug > assert
Throws an Error
with the given message if the condition is false.
Signature:
static assert(this: void, condition: boolean, errorMessage: string): boolean;
Parameter | Type | Description |
---|---|---|
this | void | |
condition | boolean | |
errorMessage | string |
Returns:
boolean
A boolean value to make linting happy…
If _BUILD.DISABLE_BREAKPOINT_FLAG
is false or unset then a breakpoint will be hit first.
Debug asserts are useful for providing hints to the programmer that they aren’t meeting the contract of the API.
function foo(a1: number) {
// not suitable for a production check, the programmer lied about the input type they supplied
_BUILD.DEBUG && _Debug.assert(a1 != null, "a1 must be supplied");
}