You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
428 B

/**
* Asserts a condition is true, throws and breaks the game if not
* @param {boolean} condition - The condition to check
* @param {string} message - Error message if assertion fails
* @throws {Error} Throws an error if the condition is false
*/
export function assert(condition, message) {
if (!condition) {
const error = new Error(`Assertion failed: ${message}`);
console.error(error);
throw error;
}
}