12345678910111213141516171819202122232425262728 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.assertThrows = exports.assert = exports.assertNever = void 0;
- // this function can be used to ensure there are no missing cases in the handling of a union type
- function assertNever(x) {
- throw new Error(`Unexpected object: ${x}`);
- }
- exports.assertNever = assertNever;
- function assert(expression, msg) {
- if (!expression) {
- throw new Error(msg);
- }
- }
- exports.assert = assert;
- function assertThrows(callback, msg) {
- let threw = false;
- try {
- callback();
- }
- catch (e) {
- threw = true;
- }
- if (!threw) {
- throw new Error(msg);
- }
- }
- exports.assertThrows = assertThrows;
- //# sourceMappingURL=assert.js.map
|