Skip to content

Commit

Permalink
Fix assert
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Mar 23, 2019
1 parent a9f794f commit 505f727
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stub/assert.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* global DEBUG */
import { noop } from '../utils';

export const AssertionError = /*@__PURE__*/ class AssertionError extends Error {
export const AssertionError = /* @__PURE__*/ class AssertionError extends Error {
constructor(message: string) {
super(message);
Object.setPrototypeOf(this, this.constructor);
Object.setPrototypeOf(this, new.target.prototype);
}
};

const assert: (test: boolean, message?: string) => void =
DEBUG ? (test, message) => {
if (!test) {
throw new AssertionError(`Assertion failed: ${message}`);
throw new AssertionError('Assertion failed' + (message ? `: ${message}` : ''));
}
} : noop;

Expand Down

0 comments on commit 505f727

Please sign in to comment.