evaluates given check expression as a strong invariant never ever violated.
Use assert to ensure an assumption at runtime. When running with assertions enabled, the check expression is evaluated immediately. A check expression evaluating to false signals a violation of invariant that should never happen. If it does, a hard error is output unconditionally to the console and an AssertionError is thrown.
Do not use assertions as a means of ordinary error checking. Here are some valid examples of assertions:
assert(() => Date.now() > 0, 'current time millis can not be before 1970 start of time!'); assert(() => total_price >= item_price, 'total is sum of individual prices and thus can not be less than each one!'); assert(() => num*num >= 0, 'squared num is less than zero!');
expression validating an assumption of the calling code, typically an arrow-function expression.
optional explanation of disaster.
used in catch-blocks or Promise rejection callbacks to ensure the caught value is an Error.
to check.
of disaster.
value evaluating to true stating error is an instance of Error.
uses toSource() if available, falling back to toString() otherwise.
to generate source of.
of func.
Generated using TypeDoc
console featuring coloring, fontSize and enabled state.