/**
 * Error indicating that an assertion failed.
 * @group Errors
 */
export class AssertionError extends Error {
    constructor(message) {
        super(message);
        this.name = 'AssertionError';
        if (Error.captureStackTrace) {
            Error.captureStackTrace(this, this.constructor);
        }
    }
}
/**
 * Assserts that the provided condition is true.
 * @internal
 */
export default function assert(condition, message) {
    if (!condition) {
        throw new AssertionError(message !== null && message !== void 0 ? message : 'Assertion failed');
    }
}
/**
 * Asserts that both values are strictly equal.
 * @internal
 */
assert.equal = function assertEqual(actual, expected, message) {
    if (actual !== expected) {
        throw new AssertionError((message !== null && message !== void 0 ? message : '') + ` ${actual} !== ${expected}`);
    }
};
/**
 * Asserts that a given object contains the specified
 * keys such that their values are defined.
 */
export function assertObjectHasDefinedKeys(input, keys, onError) {
    const missingKeys = keys.filter((property) => (input === null || input === void 0 ? void 0 : input[property]) === undefined);
    if (missingKeys.length > 0) {
        throw onError(missingKeys);
    }
}
//# sourceMappingURL=assert.js.map