/ src / lib / utils / assert.ts
assert.ts
 1  /**
 2   * Asserts that `condition` is truthy.
 3   * @param condition The condition to assert.
 4   * @param message Error message to throw on assertion error.
 5   * @throw An error if `condition` is falsy.
 6   */
 7  export default function assert(condition: unknown, message = 'Assertion Error'): asserts condition {
 8    if (!condition) {
 9      throw new Error(message);
10    }
11  }