Files
pybricks-code/src/utils/index.ts
T
2020-05-21 21:27:47 -05:00

13 lines
427 B
TypeScript

/**
* Asserts that an assumption is true. This is used to detect programmer errors
* and should never actually throw in a correctly written program.
* @param condition A condition that is assumed to be true
* @param message Informational message for debugging
*/
export function assert(condition: boolean, message: string): void {
/* istanbul ignore next */
if (!condition) {
throw Error(message);
}
}