Files
med-notes/.pnpm-store/v10/files/70/28ed7e0112466c9e1b3ce5c582aa4a3de36d705c2c4f294a145ecfb649d8f7ad03fa092454b81068e0fd6423a7e2f9a9ff3617168fd97f0d76ace0f07b41c0
2025-05-09 05:30:08 +02:00

18 lines
464 B
Plaintext

/**
* @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);
}
}