Jack Jackson 892a62f4e5 Add first PR check (#1)
To be followed by tests and `npm run build`, obviously!

Reviewed-on: #1
Co-authored-by: Jack Jackson <scubbojj@gmail.com>
Co-committed-by: Jack Jackson <scubbojj@gmail.com>
2025-03-03 23:00:04 +00:00

18 lines
464 B
JavaScript

/**
* @fileoverview Assertion utilities.
* @author Nicholas C. Zakas
*/
/**
* Throws an error if the given condition is not truthy.
* @param {boolean} condition The condition to check.
* @param {string} message The message to include with the error.
* @returns {void}
* @throws {Error} When the condition is not truthy.
*/
export function assert(condition, message = "Assertion failed.") {
if (!condition) {
throw new Error(message);
}
}